[exim] query lookups with multiple rows as result

Top Page
Delete this message
Reply to this message
Author: Marco Herrn
Date:  
To: exim-users
Subject: [exim] query lookups with multiple rows as result
Hi,

I have a problem in understanding the query style lookups in Exim 4.
I need a lookup to get a list of local parts. A I understand the FAQ
in question Q0080, this should be no problem. I have the following
router:

hosteduser:
  driver= accept
  domains= +hosted_domains
#  local_parts= ${lookup pgsql{\
#                     SELECT localpart FROM mailbox WHERE domainname='$domain'}\
#                     {$value}\
#                fail}
  local_parts= pgsql;SELECT localpart FROM mailbox WHERE domainname='$domain'
  transport= hosted_delivery
  cannot_route_message= Unknown mailbox


A you can see, I have tried two versions of the lookup. Neither of
which does what I want. The version currently active in the above
example always results in success. I have only two local parts defined
for this domain, with the names 'erwin' and 'spam', but sending a mail
to 'wbe' succeeds. Here is the appropriate debug output:


checking local_parts
search_open: pgsql "NULL"
cached open
search_find: file="NULL"
key="SELECT localpart FROM mailbox WHERE domainname='poiu.de'"
partial=-1 affix=NULL starflags=0
LRU list:
internal_search_find: file="NULL"
type=pgsql key="SELECT localpart FROM mailbox WHERE
domainname='poiu.de'"
database lookup required for SELECT localpart FROM mailbox WHERE
domainname='poiu.de'
PGSQL query: SELECT localpart FROM mailbox WHERE domainname='poiu.de'
PGSQL using cached connection for
(/var/run/postgresql/.s.PGSQL.5432)/soutdb/mail
lookup yielded: erwin
spam
wbe in "pgsql;SELECT localpart FROM mailbox WHERE
domainname='poiu.de'"? yes (matched "pgsql;SELECT localpart FROM mail
box WHERE domainname='poiu.de'")
calling hosteduser router
hosteduser router called for wbe@???
domain = poiu.de
set transport hosted_delivery
queued for hosted_delivery transport: local_part = wbe
domain = poiu.de
errors_to=NULL
domain_data=NULL localpart_data=erwin
spam
routed by hosteduser router
envelope to: wbe@???
transport: hosted_delivery


The other (currently commented out) version has the opposite effect.
It doesn't acceppt any local part. When trying to send a mail to
'spam' results in the following debug output:

checking local_parts
search_open: pgsql "NULL"
cached open
search_find: file="NULL"
key="SELECT localpart FROM mailbox WHERE domainname='poiu.de'"
partial=-1 affix=NULL starflags=0
LRU list:
internal_search_find: file="NULL"
type=pgsql key="SELECT localpart FROM mailbox WHERE
domainname='poiu.de'"
database lookup required for SELECT localpart FROM mailbox WHERE
domainname='poiu.de'
PGSQL query: SELECT localpart FROM mailbox WHERE domainname='poiu.de'
PGSQL using cached connection for
(/var/run/postgresql/.s.PGSQL.5432)/soutdb/mail
lookup yielded: erwin
spam
spam in "erwin
spam"? no (end of list)
hosteduser router skipped: local_parts mismatch
no more routers


So what am I doing wrong?

Regards
Marco
-- 
Others will look to you for stability, so hide when you bite your
nails.
--
Marco Herrn              _  ___      o             '       (_)<   _ _
                         _>(__'>            o          0         (_X %
                                   >(_`>  O         o  _; _;'7^'_ \;\ %
(GnuPG/PGP-encrypted mail preferred)       _;\ _.\ _.';;) ;,;_/;
Key ID: 0x94620736                  _  _'./_\('))_; );/\)}/`fsc