Re: proposal: psql: psql variable BACKEND_PID

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: psql: psql variable BACKEND_PID
Date: 2023-02-04 18:08:09
Message-ID: CAFj8pRDuKBApsSJrF6fNHBHd-b8+78b=Y5Ay4WjxRm2fiw9RdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

pá 3. 2. 2023 v 20:27 odesílatel Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
napsal:

>
>
> On Fri, Feb 3, 2023 at 5:42 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>
>> Hi
>>
>> We can simply allow an access to backend process id thru psql variable. I
>> propose the name "BACKEND_PID". The advantages of usage are simple
>> accessibility by command \set, and less typing then using function
>> pg_backend_pid, because psql variables are supported by tab complete
>> routine. Implementation is very simple, because we can use the function
>> PQbackendPID.
>>
>> Comments, notes?
>>
>> Regards
>>
>> Pavel
>>
>
> Interesting, and probably useful.
>
> It needs a corresponding line in UnsyncVariables():
>
> SetVariable(pset.vars, "BACKEND_PID", NULL);
>
> That will set the variable back to null when the connection goes away.
>

with doc and unsetting variable

Regards

Pavel

>
>
>
>
>

Attachment Content-Type Size
v20230204-0001-implementation-of-BACKEND_PID-psql-s-variable.patch text/x-patch 2.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-02-04 18:14:36 Re: recovery modules
Previous Message Nathan Bossart 2023-02-04 18:03:54 Re: Weird failure with latches in curculio on v15