Re: display hot standby state in psql prompt - Mailing list pgsql-hackers

From Chao Li
Subject Re: display hot standby state in psql prompt
Date
Msg-id 76528031-CBDA-4DC0-A524-FD22615BCEA5@gmail.com
Whole thread Raw
In response to Re: display hot standby state in psql prompt  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: display hot standby state in psql prompt
List pgsql-hackers

> 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/







pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Sequence Access Methods, round two
Next
From: Jakub Wartak
Date:
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)