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; }