Re: display hot standby state in psql prompt
Jim Jones <jim.jones@uni-muenster.de>
From: Jim Jones <jim.jones@uni-muenster.de>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Andreas Karlsson <andreas@proxel.se>,
Nathan Bossart <nathandbossart@gmail.com>,
Srinath Reddy Sadipiralla <srinath2133@gmail.com>,
Greg Sabino Mullane <htamfids@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Chao Li <li.evan.chao@gmail.com>
Date: 2025-11-10T08:14:49Z
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 10/11/2025 08:30, Fujii Masao wrote: > If the main goal of this feature is to help users easily determine > whether they're connected to a primary or a standby, > seems simply showing whether the server is in hot standby > should be sufficient. I'm not sure how useful it would be in practice > to show information based on default_transaction_read_only or > transaction_read_only. This "primary" or "standby" approach was actually the initial proposal, but it evolved after a few reviews. Extending it to use transaction_read_only and default_transaction_read_only adds real value to the feature, but doing so requires either: 1. Marking transaction_read_only as GUC_REPORT (controversial and rejected in the past), or 2. Querying transaction_read_only with SHOW every time the prompt is displayed within a transaction block (IMO minimal overhead -- but unconventional?). Although I lean toward the initial proposal, I can totally live with either approach, since both would be able to distinguish if a server is in hot standby or not. Should we switch back to the initial proposal? Thanks! Best, Jim