Re: [exim] Make existence of SQL table optional

Top Page
Delete this message
Reply to this message
Author: W B Hacker
Date:  
To: exim users
Subject: Re: [exim] Make existence of SQL table optional
Konstantin Kletschke wrote:
> Hello!
>
> In my config i have an alias_domain part in my config, which checks a
> table if there are aliases in it depending on domain.
>
> alias_domain:                                                                     driver = redirect
>   allow_defer                                                                     allow_fail
>   data = ${lookup mysql {MYSQL_DOMAIN_ALIAS}{$value}}                             domains = mysql;MYSQL_LOCALDOMAINS
>   retry_use_local_part
>   user = exim

>
> In many cases these tables are emtpy but I need them to be created, even
> if empty. Can I get a behaviour where the existence is optional so that
> non existand tables are created as if the are there and empty?
>
> Kind reagrds, Konsti
>


AFAIK, Exim can call any SQL you want.

The branching logic can be entirely within SQL or a hybrid of SQL and Exim's
tests or SQL returns. IF I had to do it, I'd probably use a trigger.

That said, I can't see having to do it.

Why not structure the DB so that the domain or domain_alias is just one more
field within a table that WILL always be there instead of a table of its own?

That way, you may hit missing records, may or may not want to do an INSERT to
create same, but at least do not have to create a whole table.

HTH,

Bill