I've successfully configured Postfix to use MySQL for its virtualusertable
lookups with three tables: virtual_addresses, actual_addresses, and
address_link. These are joined back together via this query, which gets the
list of all the addresses that a virtual address should "resolve" to:
query = SELECT actual_addresses.actual_address
WHERE virtual_addresses.id = address_link.virtual_address_id
AND actual_addresses.id = address_link.actual_address_id
AND virtual_addresses.virtual_address = '%s'
This works great! But in my (possibly irrational) drive for normalization, I
would like to split the user and domain portions of the "virtual" side into
two separate tables. I see how I can structure the query using the the %u
and %d parameters. So, something like this:
SELECT actual_addresses.actual_address FROM
virtual_users, virtual_domains, address_link, actual_addresses
WHERE [Some funky joins]
AND virtual_users.virtual_user = '%u'
AND virtual_domains.virtual_domain = '%d'
BUT! The docs (http://www.postfix.org/mysql_table.5.html)
say that if either
of those parameters are empty, the query is suppressed. OK, fair enough, but
then how does one handle "catch alls"? In the virtualusertable file as well
as with the original query, there are entries on the "left hand side" that
are simply @.... This would imply %u to be empty, thus no query
Can you specify multiple queries? I guess that would make sense, but it is
never explicitly stated.
I guess this would also be a good time to request additional examples in the
mysql_table(5) man page as, while the query parameters make sense, the
result_format doesn't really click.
Lead System Admin -- Senior Programmer
PGP Key: http://pgp.mit.edu/
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111