Re: proposal: psql: psql variable BACKEND_PID - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: proposal: psql: psql variable BACKEND_PID
Date
Msg-id CADkLM=fQUAGG2WXO3_2Qci+-nR3URmzi0E03Wvizwg71MORwvg@mail.gmail.com
Whole thread Raw
In response to proposal: psql: psql variable BACKEND_PID  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: psql: psql variable BACKEND_PID
List pgsql-hackers


On Fri, Feb 3, 2023 at 5:42 AM Pavel Stehule <pavel.stehule@gmail.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.



 

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Weird failure with latches in curculio on v15
Next
From: Tom Lane
Date:
Subject: First draft of back-branch release notes is done