> 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: v7-0001-psql-meta-command-conninfo-plus.patch
Description: v7-0001-psql-meta-command-conninfo-plus.patch

Reply via email to