Re: Psql meta-command conninfo+

Hunaid Sohail <hunaidpgml@gmail.com>

From: Hunaid Sohail <hunaidpgml@gmail.com>
To: pgsql-hackers@postgresql.org
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Sami Imseih <samimseih@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, Maiquel Grassi <grassi@hotmail.com.br>, Jim Jones <jim.jones@uni-muenster.de>, Tom Lane <tgl@sss.pgh.pa.us>, Nathan Bossart <nathandbossart@gmail.com>, "Imseih (AWS), Sami" <simseih@amazon.com>, Peter Eisentraut <peter@eisentraut.org>, Pavel Luzanov <p.luzanov@postgrespro.ru>, Erik Wienhold <ewie@ewie.name>, Dean Rasheed <dean.a.rasheed@gmail.com>
Date: 2025-01-16T10:54:22Z
Lists: pgsql-hackers

Attachments

Hi,

I have attached 3 new patches v37-000* which display the
\conninfo+ output as 2 columns "Parameter" and "Value".

The other 2 patches are:
1. A new libpq function, PQparameterNames, which returns
names of parameters reported by the server.
2. Mark role as GUC_REPORT.

All these patches include necessary documentation changes.
Also, code is formatted with pgindent.

Output:
postgres=# \conninfo+
                 Connection Information
           Parameter           |         Value
-------------------------------+------------------------
 Database                      | postgres
 Client User                   | hunaid
 Host                          | localhost
 Host Address                  | 127.0.0.1
 Port                          | 5430
 Options                       |
 Protocol Version              | 3
 Password Used                 | false
 GSSAPI Authenticated          | false
 Backend PID                   | 52044
 SSL Connection                | true
 SSL Library                   | OpenSSL
 SSL Protocol                  | TLSv1.3
 SSL Key Bits                  | 256
 SSL Cipher                    | TLS_AES_256_GCM_SHA384
 SSL Compression               | off
 ALPN                          | postgresql
 role                          | none
 server_encoding               | UTF8
 server_version                | 18devel
 client_encoding               | UTF8
 session_authorization         | hunaid
 standard_conforming_strings   | on
 DateStyle                     | ISO, MDY
 scram_iterations              | 4096
 default_transaction_read_only | off
 application_name              | psql
 is_superuser                  | on
 search_path                   | "$user", public
 IntervalStyle                 | postgres
 TimeZone                      | Asia/Karachi
 integer_datetimes             | on
 in_hot_standby                | off
(33 rows)

postgres=# set role test_role;
SET
postgres=> \conninfo+
                 Connection Information
           Parameter           |         Value
-------------------------------+------------------------
 Database                      | postgres
 Client User                   | hunaid
 Host                          | localhost
 Host Address                  | 127.0.0.1
 Port                          | 5430
 Options                       |
 Protocol Version              | 3
 Password Used                 | false
 GSSAPI Authenticated          | false
 Backend PID                   | 52044
 SSL Connection                | true
 SSL Library                   | OpenSSL
 SSL Protocol                  | TLSv1.3
 SSL Key Bits                  | 256
 SSL Cipher                    | TLS_AES_256_GCM_SHA384
 SSL Compression               | off
 ALPN                          | postgresql
 is_superuser                  | off
 role                          | test_role
 server_encoding               | UTF8
 server_version                | 18devel
 client_encoding               | UTF8
 session_authorization         | hunaid
 standard_conforming_strings   | on
 DateStyle                     | ISO, MDY
 scram_iterations              | 4096
 default_transaction_read_only | off
 application_name              | psql
 search_path                   | "$user", public
 IntervalStyle                 | postgres
 TimeZone                      | Asia/Karachi
 integer_datetimes             | on
 in_hot_standby                | off
(33 rows)

Looking forward to your feedback.

Regards,
Hunaid Sohail

Commits

  1. psql: Change new \conninfo to use SSL instead of TLS

  2. Change \conninfo to use tabular format

  3. Update extension lookup routines to use the syscache

  4. Improve COPY TO performance when server and client encodings match

  5. doc: Remove superfluous bracket in synopsis

  6. Remove psql support for server versions preceding 9.2.