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')

Postmap -q @domain.com mysql:/etc/postfix/aliases gives me NO results.

If I change the query to:

SELECT rcpt FROM aliases WHERE alias = '%s'

Postmap -q @domain.com mysql:/etc/postfix/aliases gives me the expected
result; u...@domain.com.

But this way I have 'disabled' my own quick and dirty implementation of
'alias' domains.
What's wrong in the second part of the query? (the query works in mysql;
there are no syntax errors)

Btw; the domains table is like this;

domain | alias_of 
domain.com
aliasdomain.com | domain.com

The (SELECT CONCAT('%u@', alias_of) FROM domains WHERE domain = '%d') part
of the query located the aliases for an 'aliased' domain. (So if an alias
for domain.com exists, this alias is also found in aliasdomain.com)

Any ideas what's messing things up?

Thanks,

Tino Donderwinkel

Reply via email to