On Sat, Aug 08, 2015 at 11:13:46PM +0200, Palica wrote: > I have figured it out! > > This is the changed query: > > query = SELECT alias FROM (SELECT alias, 0 as priority FROM alias WHERE > address='%s' AND active='1' UNION SELECT username as destination, 1 as > priority FROM mailbox WHERE username='%s' AND active='1') ORDER BY priority > LIMIT 1;
This is wrong. Postfix automatically queries for "@example.com", after failing to find a match for "user+extens...@example.com" and "u...@example.com". There is no need to attempt to replicate this in the SQL query. -- Viktor.