Please help with syntax of sql_clause within policy_bank

Daniel Funke daniel at dhag.net
Thu May 12 01:48:37 CEST 2016


Hi,

I want to read most settings within a policy bank from sql. I'm not sure 
with the syntax, but I tried:

$policy_bank{'IN_PRE_QUEUE'} = {
   syslog_ident              => 'amavis-prequeue',
   sql_clause  =>  { 'sel_policy' => "SELECT * FROM 
amavisd_select_policy WHERE policy_bank='IN_PRE_QUEUE' AND users.email 
IN (%k)" },
}

And here is my debug output:

2016-05-12T01:43:05.438728+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
lookup_sql select: SELECT * FROM amavisd_select_policy WHERE 
policy_bank='IN_PRE_QUEUE' AND users.email IN (?,?,?,?,?,?)
2016-05-12T01:43:05.438880+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
sql begin, nontransaction
2016-05-12T01:43:05.439091+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
Connecting to SQL database server
2016-05-12T01:43:05.439256+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
connect_to_sql: trying 'DBI:Pg:database=mail;host=192.168.12.26'
2016-05-12T01:43:05.444339+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
connect_to_sql: 'DBI:Pg:database=mail;host=192.168.12.26' succeeded
2016-05-12T01:43:05.444908+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
sql: preparing and executing (6 args): SELECT * FROM 
amavisd_select_policy WHERE policy_bank='IN_PRE_QUEUE' AND users.email 
IN (?,?,?,?,?,?)
2016-05-12T01:43:05.447226+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
disconnecting from SQL
2016-05-12T01:43:05.447732+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
(!)lookup_sql: sql exec: err=7, 42P01, DBD::Pg::st execute failed: 
ERROR:  missing FROM-clause entry for table "users"\nLINE 1: 
...elect_policy WHERE policy_bank='IN_PRE_QUEUE' AND users.emai...\n ^ 
at (eval 94) line 172., ,
2016-05-12T01:43:05.447905+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
(!!)TROUBLE in process_request: sql exec: err=7, 42P01, DBD::Pg::st 
execute failed: ERROR:  missing FROM-clause entry for table 
"users"\nLINE 1: ...elect_policy WHERE policy_bank='IN_PRE_QUEUE' AND 
users.emai...\n ^ at (eval 94) line 172. at (eval 95) line 330.
2016-05-12T01:43:05.448097+02:00 mail3 amavis-prequeue[16363]:(16363-01) 
(!)Requesting process rundown after fatal error

Hope, someone can help me?

Best regards
Daniel




More information about the amavis-users mailing list