Re: proposal : backend startup hook / after logon trigger - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: proposal : backend startup hook / after logon trigger
Date
Msg-id 53d42168d651bda631e55779ba5e1286.squirrel@sq.gransy.com
Whole thread Raw
In response to Re: proposal : backend startup hook / after logon trigger  (Euler Taveira de Oliveira <euler@timbira.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: Dash in Extension Names
Next
From: Nikhil Sontakke
Date:
Subject: pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers