On 13.02.23 18:33, Pavel Stehule wrote:
In every real use case you can use pg_backend_pid(), but you need to
write a complete name without tab complete, and you need to know so this
function is available.
BACKEND_PID is supported by tab complete, and it is displayed in \set
list and \? variables. Nothing less, nothing more, Custom psql variable
can have some obsolete value.
I can imagine using :BACKEND_PID in \echo command - and it just saves
you one step with its own custom variable.
It is just some more comfort with almost zero cost.
This line of argument would open us up to copying just about every bit
of session state into psql just to make it slightly easier to use.