How about this, as concat seems to be in both MySQL and PG: SELECT * from dbmail_aliases WHERE 'delivery_address' LIKE concat('%', alias, '%') limit 1;
Would that do both normal aliases, catchalls and globals? So, with a normal alias entry of '[EMAIL PROTECTED]' it would end up: SELECT * from dbmail_aliases WHERE 'delivery_address' LIKE '[EMAIL PROTECTED]' limit 1; and catchalls: SELECT * from dbmail_aliases WHERE 'delivery_address' LIKE '[EMAIL PROTECTED]' limit 1; and globals: SELECT * from dbmail_aliases WHERE 'delivery_address' LIKE '[EMAIL PROTECTED]' limit 1; so it seems that it would work in all cases. I don't right away see having any problem with extra wildcard characters in the search. It may slow things down a bit, but how often will people have alias tables of more than a million rows or so.. then you'd start to see a different I'd say. -Micah On Tuesday 19 October 2004 04:00 pm, Aaron Stone wrote: > So if we have a three-tier search, can we do this to find the first match? > > SELECT * FROM dbmail_aliases WHERE substr([EMAIL PROTECTED]) LIKE alias OR > reversesubstr([EMAIL PROTECTED]) LIKE alias OR '@' LIKE alias LIMIT 1; > > (obviously I'm faking out the functions, but you get what I mean) > > Aaron > > Micah <[EMAIL PROTECTED]> said: > > It's built into recent versions of Postfix, just with a configure option. > > Basically you just have a text file that has db connection info in it, > > and then a query to send, and the @ symbol is replaced with the deliver > > to address from the email header. > > > > So, it's pretty freeform. Mysql has pretty extensive string manipulation > > functions so I don't see a problem on Postfix's end at all. > > > > -Micah > > > > On Tuesday 19 October 2004 03:18 pm, Aaron Stone wrote: > >> The issue is that you have Postfix pre-checking the addresses against > >> the database, and only if they exist does Postfix pass the message to > >> DBMail for delivery? > >> > >> If that's the case, perhaps we can extend Postfix with the same address > >> and domain logic? I wonder if Wietse would choke on adding this... (is > >> the MySQL lookup part of stock Postfix as it is, or is it a patch > >> anyways?) > >> > >> Aaron > >> > >> Blake Mitchell <[EMAIL PROTECTED]> said: > >> > Yeah, it would likely necessitate an alias lookup daemon. I have seen > >> > a couple requests for such a thing on the list already, so that may be > >> > the direction things end up anyway. Of course that adds just that much > >> > more complexity to the whole thing, which has to be weighed against > >> > the benefits. > >> > > >> > Micah wrote: > >> >>The only downside of this I see is that I use the alias table as a > >> >> lookup table for postfix to accept/deny addresses at the smtp stage, > >> >> which is much more efficient, I have a feeling that it would barf on > >> >> a regexp address. > >> >> > >> >>Actually, now that I think about it, would it handle a [EMAIL PROTECTED] > >> >> style address? I'll dig around and see about this. > >> >> > >> >>I don't know anything about sendmail, that would be a valid question > >> >> there if anyone uses similar function for that MTA. > >> >> > >> >>-Micah > >> > > >> > _______________________________________________ > >> > Dbmail-dev mailing list > >> > Dbmail-dev@dbmail.org > >> > http://twister.fastxs.net/mailman/listinfo/dbmail-dev > > > > _______________________________________________ > > Dbmail-dev mailing list > > Dbmail-dev@dbmail.org > > http://twister.fastxs.net/mailman/listinfo/dbmail-dev