Re: proposal : backend startup hook / after logon trigger

From: "Tomas Vondra" <tv(at)fuzzy(dot)cz>
To: "Euler Taveira de Oliveira" <euler(at)timbira(dot)com>
Cc: "Tomas Vondra" <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposal : backend startup hook / after logon trigger
Date: 2011-11-11 07:49:10
Message-ID: 53d42168d651bda631e55779ba5e1286.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2011-11-11 07:57:32 pg_dump: schema with OID XXXXX does not exist - was Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers
Previous Message David E. Wheeler 2011-11-11 06:10:59 Re: Dash in Extension Names