RE: Psql meta-command conninfo+ - Mailing list pgsql-hackers

From Maiquel Grassi
Subject RE: Psql meta-command conninfo+
Date
Msg-id CP4P284MB24830F5BF17FFA7F3D733142EC452@CP4P284MB2483.BRAP284.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: Psql meta-command conninfo+  (Pavel Luzanov <p.luzanov@postgrespro.ru>)
Responses Re: Psql meta-command conninfo+
Re: Psql meta-command conninfo+
List pgsql-hackers
> Hi, Maiquel!
> On 07.02.2024 17:47, Maiquel Grassi wrote:
> "Also, it seems that the verbose parameter in the listConnectionInformation is unnecessary." > Could you point out exactly the line or code snippet you are referring to?
> +bool > +listConnectionInformation(const char *pattern, bool verbose) > > I mean that parameter verbose is not used in the function body and listConnectionInformation called only in verbose mode.

--//--

There really was no need for the bool verbose. Therefore, it was removed.
Regarding the "system_user" function, as it is relatively new, I added
the necessary handling to avoid conflicts with versions lower than version 16.

I believe in v7 patch we have a quite substantial meta-command feature.

I validated the "System User" column for three versions. This way, we have a sample:

[postgres@localhost bin]$ ./psql -h 192.168.0.5 -p 5432 -U postgres -d postgres

psql (17devel, server 14.3)
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" on host "192.168.0.5" at port "5432".
postgres=# \conninfo+
                                                                              Current Connection Information
 Database | Authenticated User | Current User | Session User | Session PID | Server Version | Server Address | Server Port | Client Address | Client Port | Socket Directory |    Host
----------+--------------------+--------------+--------------+-------------+----------------+----------------+-------------+----------------+-------------+------------------+-------------
 postgres | postgres           | postgres     | postgres     |        9008 | 14.3           | 192.168.0.5    | 5432        | 192.168.0.5    |       63631 |                  | 192.168.0.5
(1 row)

postgres=# \q
[postgres@localhost bin]$ ./psql -h 192.168.0.5 -p 5433 -U postgres -d postgres
psql (17devel, server 16.1)
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" on host "192.168.0.5" at port "5433".
postgres=# \conninfo+
                                                                                     Current Connection Information
 Database | Authenticated User | System User | Current User | Session User | Session PID | Server Version | Server Address | Server Port | Client Address | Client Port | Socket Directory |    Host
----------+--------------------+-------------+--------------+--------------+-------------+----------------+----------------+-------------+----------------+-------------+------------------+-------------
 postgres | postgres           |             | postgres     | postgres     |        3348 | 16.1           | 192.168.0.5    | 5433        | 192.168.0.5    |       63633 |                  | 192.168.0.5
(1 row)

postgres=# \q
[postgres@localhost bin]$ ./psql -h localhost
psql (17devel)
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" on host "localhost" (address "::1") at port "5432".
postgres=# \conninfo+
                                                                                    Current Connection Information
 Database | Authenticated User | System User | Current User | Session User | Session PID | Server Version | Server Address | Server Port | Client Address | Client Port | Socket Directory |   Host
----------+--------------------+-------------+--------------+--------------+-------------+----------------+----------------+-------------+----------------+-------------+------------------+-----------
 postgres | postgres           |             | postgres     | postgres     |       26147 | 17devel        | ::1            | 5432        | ::1            |       47466 | /tmp             | localhost
(1 row)

Regards,
Maiquel O. Grassi.
Attachment

pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Question about behavior of deletes with REPLICA IDENTITY NOTHING
Next
From: Laurenz Albe
Date:
Subject: Re: Question about behavior of deletes with REPLICA IDENTITY NOTHING