Re: [PATCH] A hook for session start

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Aleksandr Parfenov <a(dot)parfenov(at)postgrespro(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Subject: Re: [PATCH] A hook for session start
Date: 2017-11-03 13:19:05
Message-ID: CAB7nPqSd2YnLicwY_rYgaGPyACVAOxXCQvXRCgJZS9NiGfBhjQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 2, 2017 at 11:36 PM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Thu, Nov 2, 2017 at 5:42 AM, Aleksandr Parfenov
> <a(dot)parfenov(at)postgrespro(dot)ru> wrote:
>> Unfortunately, patches 0001 and 0002 don't apply to current master.
>>
>> The new status of this patch is: Waiting on Author
>
> Thanks for your review. Rebased versions attached.

Looking at this thread, there are clearly arguments in favor of having
a session hook after authentication. One use case mentioned by Robert
is inserting data into a table when a user logs in. I can imagine that
something like that could be applied to a session ending.

/*
+ * Setup handler to session end hook
+ */
+ if (IsUnderPostmaster)
+ on_proc_exit(do_session_end_hook, 0);
I think that it would be better to place that in ShutdownPostgres.
This way it is possible to take actions before any resource is shut
down.

Passing the database name and user name does not look much useful to
me. You can have access to this data already with CurrentUserId and
MyDatabaseId.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksandr Parfenov 2017-11-03 13:43:05 Re: [PATCH] A hook for session start
Previous Message Alvaro Herrera 2017-11-03 13:12:27 Re: Re: PANIC: invalid index offnum: 186 when processing BRIN indexes in VACUUM