Re: display hot standby state in psql prompt

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, 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>
Subject: Re: display hot standby state in psql prompt
Date: 2025-10-30 07:51:53
Message-ID: 76528031-CBDA-4DC0-A524-FD22615BCEA5@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Oct 30, 2025, at 11:42, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Tue, Oct 28, 2025 at 8:03 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2025-10-30 08:01:30 Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Previous Message Michael Paquier 2025-10-30 07:44:23 Re: Sequence Access Methods, round two