[exim] Trim down pgsql callouts

Top Page
Delete this message
Reply to this message
Author: Sam Smith
Date:  
To: exim-users
Subject: [exim] Trim down pgsql callouts
I am only a month-old Exim user, and request some assistance.

I am trying to setup a variable for a pgsql callout so that exim only
calls out to postgres once per message.

As you can see from the variable, it requests three fields: uid,
username, and mailbox.

When I researched online, it was suggested that formatting the query in
this way would allow exim to read from the cache of the initial callout,
making operations a lot faster.

However, looking at postgres' log, it shows 3 callouts made at the same
time. Is there any way to avoid this?

EXAMPLE OF THE VARIABLE:
PGS_VAR = {lookup pgsql \
   {select mailbox,username,uid from mailtest \
       where username='${quote_pgsql:$local_part}'}}



EXAMPLE OF A ROUTER USING THE VARIABLE:
db_user:
debug_print = "R: local_user for $local_part@$domain"
driver = accept
domains = +local_domains
local_parts = ${extract {username}{$PGS_VAR}}
transport = db_mail_spool
cannot_route_message = Unknown user : not a v_user


Any help would be appreciated!

--Sam