On 11 Listopad 2011, 3:23, Euler Taveira de Oliveira wrote: > On 10-11-2011 21:12, Tomas Vondra wrote: >> I occasionally need to perform some action whenever a user connects, and >> there's nothing like an "AFTER LOGON" trigger (available in some other >> databases). >> > Are you proposing an on-logon hook or an on-connect trigger? It is two > separate things. The former can't solve some tasks (e.g. execute whatever > pl > code) and the latter can't be implemented with a simple hook (you will > have to > propose a syntax and offer some machinery to execute the pl code).
I'm proposing a backend startup hook. I agree that it's a bit low-level tool, but it's not exactly true you can't call a PL function from the hook - you can look it up and call through fmgr. You'd have to hard code the name somewhere or something, but it's possible. And you can call C functions from a PL, so in the end the possibilities are about the same, except that a proper trigger solution requires a lot of plumbing (catalogue, syntax, ...). That might happen in the future, but I'm not proposing that now. > Of course, if you want to propose any of these ideas, keep in mind that a > symmetric functionality (e.g. on-logoff hook or on-disconnect trigger) > should > be implemented too. Well, there's an on_proc_exit() callback, which IMHO serves as a backend shutdown hook. Tomas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers