Re: display hot standby state in psql prompt

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Subject: Re: display hot standby state in psql prompt
Date: 2026-01-27 08:36:54
Message-ID: 750f400d-dbef-4049-a007-73b075681b3e@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27/01/2026 04:46, Fujii Masao wrote:
> Yeah, I'm fine with switching back to the original proposal.

PFA v8 containing the original proposal.

It now only checks in_hot_standby to determine if the current state of
the connected server is "primary" or "standby".

psql (19devel)
Type "help" for help.

postgres=# \set PROMPT1 '[%i] # '
[standby] # SHOW in_hot_standby;
in_hot_standby
----------------
on
(1 row)

[standby] # SELECT pg_promote();
pg_promote
------------
t
(1 row)

[primary] # SHOW in_hot_standby;
in_hot_standby
----------------
off
(1 row)

[primary] #

The documentation was updated accordingly.

Thanks!

Best, Jim

Attachment Content-Type Size
v8-0001-Add-i-prompt-escape-to-indicate-hot-standby-statu.patch text/x-patch 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-01-27 08:41:09 Re: tablecmds: reject CLUSTER ON for partitioned tables earlier
Previous Message Chao Li 2026-01-27 08:30:10 Re: tablecmds: fix bug where index rebuild loses replica identity on partitions