Re: New feature proposal (trigger) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: New feature proposal (trigger)
Date
Msg-id 14468.1579806075@sss.pgh.pa.us
Whole thread Raw
In response to Re: New feature proposal (trigger)  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> čt 23. 1. 2020 v 17:26 odesílatel Sergiu Velescu <Sergiu.Velescu@endava.com>
> napsal:
>> I would like to propose a new feature which is missing in PgSQL but quite
>> useful and nice to have (and exists in Oracle and probably in some other
>> RDBMS), I speak about “Database Level” triggers: BeforePgStart,
>> AfterPgStarted, OnLogin, OnSuccessfulLogin, BeforePGshutdown, OnLogOut – I
>> just mentioned some of it but the final events could be different.

> Do you have some examples of these useful triggers?
> I don't know any one.

See also the fate of commit e788bd924, which proposed to add
on-session-start and on-session-end hooks.  Getting that sort of thing
to work safely is a LOT harder than it sounds.  There are all sorts of
definitional and implementation problems, at least if you'd like the
hook or trigger to do anything interesting (like run a transaction).

I rather suspect that exposing such a thing at SQL level would also add
a pile of security considerations (i.e. who's allowed to do what to whom).
The hook proposal didn't have to address that, but a trigger feature
certainly would.

Maybe it's all do-able, but the work to benefit ratio doesn't look
very appetizing to me.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: making the backend's json parser work in frontend code
Next
From: Bruce Momjian
Date:
Subject: Re: making the backend's json parser work in frontend code