Re: proposal: psql: psql variable BACKEND_PID

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: proposal: psql: psql variable BACKEND_PID
Дата
Msg-id 20230211210301.mfz3vwk5qe2ln22y@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: proposal: psql: psql variable BACKEND_PID  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hi,

On 2023-02-09 10:11:21 +0100, Pavel Stehule wrote:
> first and main (for me) - I can use psql variables tab complete - just
> :B<tab> - it is significantly faster
> second - I can see all connection related information by \set
> third - there is not hook on reconnect in psql - so if you implement
> BACKEND_PID by self, you ensure to run query with pg_backend_pid() after
> any reconnect or connection change.
> 
> It is clean so you can run "select pg_backend_pid() AS "BACKEND_PID" \gset"
> and you can store it to .psqlrc. But most of the time I am in customer's
> environment, and I have the time, possibility to do a complete setup of
> .psqlrc. It looks (for me) like a generally useful feature to be
> everywhere.

I personally just solved this by using %p in PROMPT*. Not that that serves
quite the same niche.

I guess the fact that we have %p is a minor precedent of psql special casing
backend pid in psql.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vladimir Churyukin
Дата:
Сообщение: Re: Improving inferred query column names
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: refactoring relation extension and BufferAlloc(), faster COPY