The stored procedure seems like and excellent solution. However, I've a problem. I can call the alias as the user postfix uses and get the right result, but when postfix does it, I get:
warning: mysql query failed: PROCEDURE postfix.lookup_alias can't return a result set in the given context It sounds like the solution to this is to set the CLIENT_MULTI_STATEMENTS flag in the MYSQL C API. I read a thread from January about this same goal, with the same issue. http://www.mail-archive.com/postfix-users@postfix.org/msg20542.html But the thread leaves the issue unresolved. Sounds as though a stored procedure can't be used in a mysql lookup table query. Any thoughts, anybody? On Sat, 25 Sep 2010 13:04:11 +0200 Jeroen Geilman <jer...@adaptr.nl> wrote: > On 09/25/2010 05:11 AM, Dan Farrell wrote: > > Hi All, > > > > This list has been super helpful in the past, so I am hoping that > > you'll have an idea for me. > > > > Synopsis: does anybody know a way I can insert logging data into a > > mysql table when aliases are looked up in a > > virtual_alias_maps mysql lookup table? > > > > If you incorporate that into your query, sure. > > > I recently set up a mysql lookup table for virtual_alias_maps to > > use in addition to some file lookup tables I've been using. It > > works great with a little web interface for creating new aliases. > > > > But now I want to be able to log access to the lookup table. > > Ideally I'd like to know what server's connecting, what address > > it's trying to deliver to, and what I said in return. > > > > As long as postfix has that data at the moment of query > execution/result, you can do with it whatever you want. > > > Postfix is currently logging all this stuff through syslog, but i > > would really like to integrate the logs into the website. To do > > that, I could parse the logs, but that seems rather tedious. So I > > am trying to figure out a way to add an update into the sql query > > itself. > > > > > > Write a stored procedure and call it. > > -- > J. >