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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Nikolai Zhubr <n-a-zhubr(at)yandex(dot)ru>
Cc: "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:50:51
Message-ID: CAFj8pRAPc=dD4escQDogunekVA4e7Cge99-ShRPDVonP8psRgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2015-09-26 19:53 GMT+02:00 Nikolai Zhubr <n-a-zhubr(at)yandex(dot)ru>:

> 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?

I don't know. I am pretty sceptical - from my experience this request was
related to unhappy designed projects.

Pavel

>
>
>
> Thank you,
> Nikolai
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

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