Hai Nguyen wrote:
> Hi,
>
> exim4.conf.template:
> plain_server:
> driver = plaintext
> public_name = PLAIN
> server_condition = ${lookup pgsql {select some_condition from some_table
> where some_condition ='$auth2' and other_condition='$auth3'}{yes}{no}}
> server_set_id = $auth2
> server_prompts = :
> .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
> server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
> .endif
>
> exim4.conf.localmacros:
> MAIN_TLS_ENABLE = true
> hide pgsql_servers = some_host/some_db/some_user/some_pass:\
> other_host/other_db/other_user/other_pass
> daemon_smtp_ports = 25 : 587
>
> If credentials for some_db are correct, it never looks up other_db even
> though the first pgsql search returns NULL.
> What I am trying to achieve is that if the first search is unsuccessful
> (wrong credentials or failed lookup), it should continue to servers in the
> pgsql_servers list. Any suggestions would be highly appreciated.
>
> Thanks,
> Hai Nguyen.
A NULL return is valid, SQL-wise. The subsequent servers would only be
checked if there was no ability to *connect* to earlier ones.
If you want it to check more than one DB until all possibilities have
been exhausted, you'll have to code it to make successive attempts until
it matchs and advances to the next step ELSE fails and bails.
Generally EASIER to merge the data so any-available DB will have it ALL...
.. more especially as a proper PostgreSQL install has a very low
probability of failure in this sort of use anyway.
Link reliability is a separate issue, but periodic sync'ing to keep a
'local' copy current should be able to keep up with the typical rate of
UID:PWD changes... PG can be set to trigger an export only on change, so
there need not be much load.
Bill
--
韓家標