[exim] strange psql quoting behaviour

Top Page
Delete this message
Reply to this message
Author: Thomas Spreng
Date:  
To: exim-users
Subject: [exim] strange psql quoting behaviour
Hi,

i have a strange problem concerning psql lookups and character
quoting. In
one of the routers [1] a psql lookup is done to check if the email
address in
question has a local delivery target or not. Now, if the address to be
tested
contains an underscore ('_') character, the lookup fails even if it
should return
something. If the address doesn't contain an underscore everything
runs fine.

If I test the behaviour of the configuration with:
# exim -d -bt with_underscore@???
i can see the actual query that has been executed by the psql
connector. This looks
as expected including the escaped (with '\') underscore character.
According to the
output of the test no data is returned. But if I run the very same
query in the psql
console I get a result.

Anyone has an idea what the problem could be? I have absolutely no
idea since the
query reported by 'exim -bt..' should return something.

Any help would be very appreciated.

cheers,

tom.


[1] The router in question:
<snap>
virtual_domains:
  driver = redirect
  allow_fail
  data = ${lookup pgsql{select smtp from mail_users u,mail_domains d \
                where localpart = '${quote_pgsql:$local_part}' \
                and domain = '${quote_pgsql:$domain}' \
                and d.enabled = '1' \
                and u.enabled = '1' \
                and u.domain_id = d.domain_id}}
  local_part_suffix = -*
  local_part_suffix_optional
  retry_use_local_part
  file_transport = virtual_delivery
  reply_transport = address_reply
  pipe_transport = address_pipe
</snap>