From bcd16e5adef604ea1aedf846c386638779c182a3 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 22 Jun 2016 22:44:14 -0700 Subject: [PATCH] Transfer 'query' field into table, selection and where if possible --- postfix/postfix-lib.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/postfix/postfix-lib.pl b/postfix/postfix-lib.pl index c78d8bb47..36caf0270 100755 --- a/postfix/postfix-lib.pl +++ b/postfix/postfix-lib.pl @@ -2078,6 +2078,12 @@ else { local $v = &get_real_value($value."_".$k); $conf->{$k} = $v; } + if ($conf->{'query'} =~ /^select\s+(\S+)\s+from\s+(\S+)\s+where\s+(\S+)\s+=\s+'\%s'/i && !$conf->{'table'}) { + # Try to extract table and fields from the query + $conf->{'select_field'} = $1; + $conf->{'table'} = $2; + $conf->{'where_field'} = $3; + } } return $conf; }