Re: Server-side hooks for user session start and session end

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nikolai Zhubr <n-a-zhubr(at)yandex(dot)ru>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Server-side hooks for user session start and session end
Date: 2015-09-26 18:41:52
Message-ID: CAFj8pRCyT+V4vHseQeh=Nh1BP3ez0YMh_tedXLdfq6XWnOVyMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2015-09-26 20:29 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > 2015-09-26 19:59 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> >> 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
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-09-26 19:03:51 Re: Server-side hooks for user session start and session end
Previous Message Tom Lane 2015-09-26 18:29:36 Re: Server-side hooks for user session start and session end