public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pavel Luzanov <[email protected]>
To: Maiquel Grassi <[email protected]>
To: Nathan Bossart <[email protected]>
Cc: Erik Wienhold <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Psql meta-command conninfo+
Date: Fri, 9 Feb 2024 10:58:15 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CP8P284MB249652F5F0BE828C20A38348EC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
References: <CP8P284MB24965CB63DAC00FC0EA4A475EC462@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<20240206181919.GA3853632@nathanxps13>
<aevq2dxmw2xm2rc3nh2wdcozunipco447mf4rpm7efvqvz4wk2@mo3zmf2ulbzu>
<CP8P284MB2496B51FC5ED9BD6527D459DEC462@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<20240206210605.GA3903769@nathanxps13>
<20240206211205.GA3903996@nathanxps13>
<CP8P284MB24965479BA59DF5C2CC01CA0EC462@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<20240206215022.GA3452@nathanxps13>
<CP8P284MB2496A17A9852265A0F363A6AEC452@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP8P284MB24961361A9C1D32C28A7EC0EEC452@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP4P284MB24830F5BF17FFA7F3D733142EC452@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM>
<[email protected]>
<CP8P284MB249652F5F0BE828C20A38348EC442@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM>
Hi, Maiquel!
The patch v10 build ends with a warning:
$ make -j --silent
describe.c:911:1: warning: no previous prototype for ‘listConnectionInformation’ [-Wmissing-prototypes]
911 | listConnectionInformation()
| ^~~~~~~~~~~~~~~~~~~~~~~~~
About terms.
postgres@postgres(17.0)=# \x \conninfo+
Expanded display is on.
Current Connection Information
-[ RECORD 1 ]------+---------
Database | postgres
Authenticated User | postgres
System User |
Current User | postgres
Session User | postgres
*Session PID | 951112 *Server Version | 17devel
Server Address |
Server Port | 5401
Client Address |
Client Port |
Socket Directory | /tmp
Host |
It looks like "Session PID" is a new term for the server process identifier.
How about changing the name to "Backend PID" (from pg_backend_pid) or even PID (from pg_stat_activity)?
On 08.02.2024 17:58, Maiquel Grassi wrote:
> > 1. > + if (db == NULL) > + printf(_("You are currently not connected to
> a database.\n")); > > This check is performed for \conninfo, but not
> for \conninfo+.
> 1. The connection check for the case of \conninfo+ is handled by
> "describe.c" itself since it deals with queries. I might be mistaken,
> but I believe that by using "printQuery()" via "describe.c", this is
> already ensured, and there is no need to evaluate the connection status.
I found that \conninfo and \conninfo+ act differently when the connection is broken.
I used pg_terminate_backend function from another session to terminate an open psql session.
After that, \conninfo does not see the connection break (surprisingly!), and \conninfo+ returns an error:
postgres@postgres(17.0)=# \conninfo+
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: Succeeded.
postgres@postgres(17.0)=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/tmp" at port "5401".
Another surprise is that this check:if (db == NULL) did not work in both cases.
--
Pavel Luzanov
Postgres Professional:https://postgrespro.com
view thread (43+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Psql meta-command conninfo+
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox