2015-09-26 20:29 GMT+02:00 Tom Lane <tgl@xxxxxxxxxxxxx>:
Pavel Stehule <pavel.stehule@xxxxxxxxx> writes:
> 2015-09-26 19:59 GMT+02:00 Tom Lane <tgl@xxxxxxxxxxxxx>:
>> 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.
You'd have to start your own transaction if you wanted one, and any
uncaught error would effectively be FATAL because it would terminate the
session, but otherwise I don't see why that wouldn't work.
Probably I didn't start transaction.
I'll check it.
Regards
Pavel
regards, tom lane