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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
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 17:59:47
Message-ID: 1292.1443290387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr <n-a-zhubr(at)yandex(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2015-09-26 18:23:03 Re: Server-side hooks for user session start and session end
Previous Message Nikolai Zhubr 2015-09-26 17:53:58 Re: Server-side hooks for user session start and session end