Re: display hot standby state in psql prompt
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>,
Nathan Bossart <nathandbossart@gmail.com>,
Srinath Reddy Sadipiralla <srinath2133@gmail.com>,
Greg Sabino Mullane <htamfids@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-30T07:51:53Z
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 Oct 30, 2025, at 11:42, Fujii Masao <masao.fujii@gmail.com> wrote:
>
> On Tue, Oct 28, 2025 at 8:03 PM Jim Jones <jim.jones@uni-muenster.de> wrote:
>>
I did a quick test, and found a problem. I shutdown the server, and “\c” reconnecting failed, but psql still show “read/write”, which seems wrong:
```
"read/write"\c
connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Previous connection kept
hs=off ro=off
"read/write"
hs=off ro=off
"read/write"
hs=off ro=off
"read/write"
hs=off ro=off
"read/write”
```
Looks like I am too late to vote. Actually, if I had the chance, I would vote “rw/ro”.
And a question:
```
+ if (!hs || !ro)
+ strlcpy(buf, _("unknown"), sizeof(buf));
+ else if (strcmp(hs, "on") == 0 || strcmp(ro, "on") == 0)
+ strlcpy(buf, "read-only", sizeof(buf));
+ else
+ strlcpy(buf, "read/write", sizeof(buf));
```
Why wrap “unknown” in "_()” but not “read-only” and “read/write”?
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/