Willy De la Court a écrit :
> On Friday 31 July 2009, Tino Donderwinkel wrote:
>> I have a virtual_alias map setup that uses this mySQL query;
>>
>> SELECT rcpt FROM aliases WHERE alias = '%s' OR alias = (SELECT
>> CONCAT('%u@', alias_of) FROM domains WHERE domain = '%d')
> 
> hmm I think the way the % vars are replaced is the problem, try this.
> 
> CONCAT('%u', '@', alias_of)
> 
> or the easier way (this is what I use.
> 
>   SELECT
>       goto
>    FROM
>       alias,
>       alias_domain
>    WHERE
>       alias_domain.alias_domain = '%d' AND
>       alias.address = concat('%u', '@', alias_domain.target_domain) AND
>       alias.active = 1 AND
>       alias_domain.active = 1
> 
> 

this doesn't work unless he "mixes" his tables more than a little...

OP could try UNION, but better keep things simple:

virtual_alias_maps =
        proxy:mysql:/.../valias.cf
        proxy:mysql:/.../domainalias.cf

and have one query for "user" aliases and one query for "domain" aliases.



Reply via email to