-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 01 August 2009, Tino Donderwinkel wrote: > > > > 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 > > I have all domains in 1 table. Changing that might have some implications. > > Made a mistake here this is only the domain alias part the other query is the standard alias translation
SELECT goto FROM alias WHERE address = '%s' AND active = 1 virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual-alias-maps.cf, proxy:mysql:/etc/postfix/mysql/virtual-alias-alias-maps.cf > I've also tried; > > SELECT rcpt FROM aliases WHERE alias IN ('%s', (SELECT CONCAT('%u', '@', > `alias_of`) FROM domains WHERE domain = '%d')) > > This works in mysql under all conditions... > > e.g. SELECT rcpt FROM aliases WHERE alias IN ('@test.com', (SELECT > CONCAT('', '@', `alias_of`) FROM domains WHERE domain = 'test.com')) > gives me: u...@test.com I don't think postmap will ever replace %s with '@test.com' I can be mistaken. I think the %s is always a full address with user and domain part. Can someone comment on this? >> but postmap gives me an empty result... >> - -- Simple things make people happy. Willy De la Court PGP Public Key at http://www.linux-lovers.be/download/public_key.asc PGP Key fingerprint = 784E E18F 7F85 9C7C AC1A D5FB FE08 686C 37C7 A689 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkp0O0kACgkQ/ghobDfHpon5kACggPwalWx5UyK8fY9DQDp/kfcC 9uEAoJBbDJ0t//9UcVPS+EIKp9115HHg =wDI/ -----END PGP SIGNATURE-----