2015-09-26 19:59 GMT+02:00 Tom Lane <t...@sss.pgh.pa.us>: > Pavel Stehule <pavel.steh...@gmail.com> writes: > > 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr <n-a-zh...@yandex.ru>: > >> And the events of session start and session end would seem quite generic > >> and usefull anyway? > > > I don't know. I am pretty sceptical - from my experience this request was > > related to unhappy designed projects. > > A session-end hook seems pretty problematic to me: you simply cannot > guarantee that it will run at all. (Consider process crash or server > abort cases.) So anything built on the assumption that it gets to run > at session end is going to be inherently unreliable. > > A session-start hook is already possible at the C-code level, using > session_preload_libraries. It wouldn't be hard to write an extension > that exposed that in some useful way to SQL code. >
years ago I tried it, if I remember well. I had a problems with SPI calls, because some caches was not initialized. I am not sure, and I didn't test last time. Regards Pavel > > regards, tom lane >