| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> | 
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> | 
| Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, 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 12:09:52 | 
| Message-ID: | 01405F2A-181B-4D64-9952-690D51AAFBF8@gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
> On Oct 30, 2025, at 18:50, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
> 
> 
> 
> On 30/10/2025 11:28, Chao Li wrote:
>> How about this?
>> 
>> ```
>> [read/write]select * from test_multi order by category, name;
>> FATAL:  terminating connection due to administrator command
>> server closed the connection unexpectedly
>> This probably means the server terminated abnormally
>> before or while processing the request.
>> The connection to the server was lost. Attempting reset: Failed.
>> The connection to the server was lost. Attempting reset: Failed.
>> []
>> []
>> ```
>> 
>> After shutting down the server, I ran a random statement in psql, then the prompt became empty, does it suppose to show “_unknown”?
> 
> This behaviour is normal -- at least it is how other options behave. See
> %p and the newly committed %S:
> 
> postgres=# \set PROMPT1 '[%p] # '
> [1376487] # \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
> [1376487] # SELECT 1;
> FATAL:  terminating connection due to administrator command
> server closed the connection unexpectedly
>        This probably means the server terminated abnormally
>        before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> The connection to the server was lost. Attempting reset: Failed.
> [] # SELECT 1;
> You are currently not connected to a database.
> [] #
> 
> ====
> 
> psql (19devel)
> Type "help" for help.
> 
> postgres=# \set PROMPT1 '[%S] # '
> ["$user", public] # \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
> ["$user", public] # SELECT 1;
> FATAL:  terminating connection due to administrator command
> server closed the connection unexpectedly
>        This probably means the server terminated abnormally
>        before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
> The connection to the server was lost. Attempting reset: Failed.
> [] # SELECT 1;
> You are currently not connected to a database.
> [] #
> 
Thanks for the clarification. Though I still think that might be a bug, but I agree that doesn’t belong to the current patch.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniil Davydov | 2025-10-30 12:12:03 | Re: Batching in executor | 
| Previous Message | Nazir Bilal Yavuz | 2025-10-30 11:58:48 | Re: ci: Improve OpenBSD core dump backtrace handling |