Re: Psql meta-command conninfo+

From: Hunaid Sohail <hunaidpgml(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Sami Imseih <samimseih(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Maiquel Grassi <grassi(at)hotmail(dot)com(dot)br>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, Erik Wienhold <ewie(at)ewie(dot)name>
Subject: Re: Psql meta-command conninfo+
Date: 2025-01-14 07:57:29
Message-ID: CAMWA6yaO82QyW0p3_38QdVykvFT=qWfcjPxOFam10SW_tOyt-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Jan 13, 2025 at 4:12 PM Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
wrote:

> I don't like the 3-table format either. I think it should be a single
> table.
>
> The trouble with v35 is that it produces 1 row with lots of columns,
> which is pretty unreadable unless expanded mode is used. So I think we
> should just do it that way round by default -- i.e., make it like
> \dconfig and have 2 columns, "Parameter" and "Value", with lots of
> rows.
>
> Perhaps it could also have a "Description" column, which might help
> with things like distinguishing between authenticated user and session
> user.
>

I've tried the approach and attached the output.
I'm not attaching the patch as it requires some formatting. Does this look
good?
I have added a one liner description that is consistent with libpq docs.

postgres=# \conninfo+
Connection Information
Parameter | Value |
Description
----------------------+------------------------+--------------------------------------------------------------------------------
Database | postgres | Displays the database name
of the connection.
Client User | hunaid | Displays the name of the
user connected to the database as returned by PQuser.
Host | localhost | Displays the server host
name of the active connection.
Host Address | 127.0.0.1 | Displays the server IP
address of the active connection.
Port | 5430 | Displays the port number
used for the database connection.
Options | | Displays any command-line
options passed in the connection request.
Protocol Version | 3 | Displays the
frontend/backend protocol being used.
Password Used | false | Indicates whether a
password was used during authentication.
GSSAPI Authenticated | false | Indicates if GSSAPI
authentication was used for the connection.
Backend PID | 43465 | Displays the process ID of
the backend for the connection.
SSL Connection | true | Indicates whether SSL
encryption is in use for the connection.
SSL Protocol | TLSv1.3 | Displays the SSL protocol
used for the connection.
SSL Cipher | TLS_AES_256_GCM_SHA384 | Displays the SSL cipher
used for the connection.
SSL Compression | off | Indicates whether SSL
compression is enabled.
ALPN | postgresql | Displays the ALPN protocol
used in the SSL connection.
(15 rows)

I was wondering how we can show the descriptions of parameters
from PQparameterStatus. We can create an array of descriptions,
but if the order changes somehow, it can mess things up.

Looking forward to your opinions. Can we continue with this approach?

Regards,
Hunaid Sohail

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2025-01-14 08:14:34 Re: XMLDocument (SQL/XML X030)
Previous Message Rahila Syed 2025-01-14 07:45:59 Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.