Re: Psql meta-command conninfo+

Hunaid Sohail <hunaidpgml@gmail.com>

From: Hunaid Sohail <hunaidpgml@gmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Maiquel Grassi <grassi@hotmail.com.br>, Jim Jones <jim.jones@uni-muenster.de>, Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@alvh.no-ip.org>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, 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>
Date: 2024-10-07T06:17:01Z
Lists: pgsql-hackers
Hi David,

Thank you for your feedback.

On Fri, Oct 4, 2024 at 11:56 AM David G. Johnston <
david.g.johnston@gmail.com> wrote:

> It seems to me a more useful definition for what this command should print
> out is basically the entire contents of:
>
> https://www.postgresql.org/docs/current/libpq-status.html
>
> That page has three sections:
> Connection Invariants
> Current Status
> Encryption (TLS)
>
> I would suggest that we thus produce three tables - one for each.  In the
> case of SSL, a message saying “not used” instead of a table full of blanks
> probably suffices, though I’d lean to print all of what is available at all
> times.
>

We can try this approach. I would also like to have other's opinions on
this approach.

Most functions are already used, while some are not required (IMO). I have
listed all the functions from the doc link you provided, along with my
brief comments based on the latest patch (v35).

PQdb - already used
PQuser - already used
PQpass - no need
PQhost - already used
PQhostaddr - already used
PQport - already used
PQtty - no need
PQoptions - can be used

PQstatus - no need
PQtransactionStatus - can be used
PQparameterStatus - already used
PQprotocolVersion - already used
PQserverVersion  - no need
PQerrorMessage  - no need
PQsocket  - no need
PQbackendPID - already used
PQconnectionNeedsPassword  - no need
PQconnectionUsedPassword - can be used
PQconnectionUsedGSSAPI - already used

PQsslInUse - already used
PQsslAttribute - only key_bits attribute not used
PQsslAttributeNames  - no need
PQsslStruct  - no need
PQgetssl  - no need

For PQparameterStatus, some parameters are already used.
server_version and application_name were already discussed and removed in
v12 and v29 respectively. Do we need other parameters?


> Within that framework having \conninfo[+[CSE][…]] be the command -
> printing out only the table specified would be the behavior (specifying no
> suffix letters prints all three) - would be an option.
>

3 separate tables without suffix?

If others are okay with this, I can work on this approach and will provide
a patch before the next CF.

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.