Re: display hot standby state in psql prompt
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Fujii Masao <masao.fujii@gmail.com>, Srinath Reddy Sadipiralla <srinath2133@gmail.com>, Greg Sabino Mullane <htamfids@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-27T16:23:12Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
psql: Add %i prompt escape to indicate hot standby status.
- dddbbc253b92 19 (unreleased) landed
-
Mark search_path as GUC_REPORT
- 28a1121fd912 18.0 cited
On Mon, Oct 27, 2025 at 09:08:17AM +0100, Jim Jones wrote: > + Displays the session's read-only status as <literal>read-only</literal> > + if the server is in hot standby (<literal>in_hot_standby</literal> is > + <literal>on</literal>) or the default transaction mode is read-only > + (<literal>default_transaction_read_only</literal> is <literal>on</literal>), > + or <literal>read-write</literal> otherwise. Useful for identifying > + sessions that cannot perform writes, such as in replication setups. This was briefly mentioned upthread, but I'm a little concerned that this doesn't respond to commands like SET TRANSACTION READ ONLY. I wonder if we should mark transaction_read_only as GUC_REPORT and use that instead. FWIW I see that we marked search_path as GUC_REPORT somewhat recently (see commit 28a1121). -- nathan