From: | Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com>, Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Naoya Anzai <nao-anzai(at)xc(dot)jp(dot)nec(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com> |
Subject: | Re: Comfortably check BackendPID with psql |
Date: | 2015-07-05 12:11:38 |
Message-ID: | 55991EFA.3040605@dalibo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/06/2015 06:56, Noah Misch wrote:
> On Thu, Jun 11, 2015 at 04:05:13PM -0500, Jim Nasby wrote:
>> On 6/11/15 4:55 AM, Andres Freund wrote:
>>> On 2015-06-11 09:41:17 +0000, Naoya Anzai wrote:
>>>> This is a so tiny patch but I think it is very useful for hackers and DBAs.
>>>> When we debug with psql, we frequently use "SELECT pg_backend_pid();".
>>>> This can change the input of the 24 characters to the only 4 characters!
>>>
>>> Not a big fan of that abbreviation itself. What I'd wondered about
>>> instead - and actually had patched into my psql at some point - is
>>> adding an appropriate escape to psql's PROMPT. I think that'd serve your
>>> purpose as well?
>>
>> +3.14159; that would be hugely helpful when using gdb.
>
+1
> You can get that today. In ~/.psqlrc:
>
> SELECT pg_catalog.pg_backend_pid() AS backend_pid \gset
> \set PROMPT1 '%m %:backend_pid: %/%R%# '
>
> It doesn't update after \connect, but the overlap between my use of \connect
> and my use of debuggers is tiny.
>
>
Tiny for me too, but I sometimes had the need.
I can't really see any good reason not to add a %p escape to psql's
PROMPT, so I'm attaching a simple patch to implement it. Unless someone
objects, I'll add it to the next commitfest.
--
Julien Rouhaud
http://dalibo.com - http://dalibo.org
Attachment | Content-Type | Size |
---|---|---|
psql_pid-v1.patch | text/x-patch | 1.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2015-07-05 12:49:12 | Re: Let PostgreSQL's On Schedule checkpoint write buffer smooth spread cycle by tuning IsCheckpointOnSchedule? |
Previous Message | Christoph Berg | 2015-07-05 08:25:09 | [patch] typo in brin.sql |