Skip site navigation (1) Skip section navigation (2)

proposal : backend startup hook / after logon trigger

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: proposal : backend startup hook / after logon trigger
Date: 2011-11-11 00:12:02
Message-ID: 4EBC6852.5030605@fuzzy.cz (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi,

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).

Is there any particular reason why there's not a "backend start hook",
executed right after a backend is initialized? I've tried a very simple
PoC (basically just a new hook definition, called from PostgresMain(),
see the after-logon-hook.diff (and a simple module that uses it is in
logon.c).

This obviously is not a complete patch or something, but is there a good
reason why this is a stupid idea?

Obviously this is a bit low-level approach, as most of the time the
triggers are implemented in a PL. But who says you can't call a PL from
the C module ...

Tomas

Attachment: logon.c
Description: text/x-c (1.1 KB)
Attachment: after-logon-hook.diff
Description: text/plain (1.6 KB)

Responses

pgsql-hackers by date

Next:From: Dickson S. GuedesDate: 2011-11-11 00:20:46
Subject: Re: proposal: psql concise mode
Previous:From: Thom BrownDate: 2011-11-10 23:56:46
Subject: Re: [COMMITTERS] pgsql: Enable CHECK constraints to be declared NOT VALID

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group