Re: Server-side hooks for user session start and session end - Mailing list pgsql-general

From Nikolai Zhubr
Subject Re: Server-side hooks for user session start and session end
Date
Msg-id 5606DBB6.9080501@yandex.ru
Whole thread Raw
In response to Re: Server-side hooks for user session start and session end  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Server-side hooks for user session start and session end
List pgsql-general
Hi Pavel,
26.09.2015 19:26, Pavel Stehule wrote:
[...]
> This cannot be solved without patching PostgreSQL source code :( . There
> are not good hooks for custom extension. Patch is relative simple, but I
> cannot to publish it.

Ok, I see. Creating such a patch might be not very hard actually.
But living with custom-patched server could cause massive pain later...

> You have to modify main loop in src/backend/tcop/postgres.c file. Login
> point can be immediately before loop. Logout point can be joined to
> 'X',EOF message.

Thanks for the hint, I've noticed this loop while searching for some
more 'regular' methods.

> Attention - there are some corner case, what are necessary to solve -
> mainly how to handle exceptions in login/logout procedures.

Right. And I'd guess that might be the reason for not implementing such
thing in upstream (yet) - the lack of proper context for exceptions and
such.

> p.s. I understand so this hack is necessary for porting older
> application from other databases, but I am not sure if it is a good idea
> to use it. Not all tasks can be solved well in database.

No, the application in question has been running on top of postgres
almost from its very start and for quite some years successfully now, it
definitely does not contain anything foreign to postgres.
And the events of session start and session end would seem quite generic
and usefull anyway?


Thank you,
Nikolai


pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Server-side hooks for user session start and session end
Next
From: Pavel Stehule
Date:
Subject: Re: Server-side hooks for user session start and session end