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