Hi,

On Sat, Sep 14, 2024 at 10:50 PM Tom Lane <t...@sss.pgh.pa.us> wrote:

> Alvaro Herrera <alvhe...@alvh.no-ip.org> writes:
> > I don't understand why this is is printing half the information in
> > free-form plain text and the other half in tabular format.  All these
> > items that you have in the free-form text lines should be part of the
> > table, I think.
>
> +1, that was my reaction as well.  I can see the point of showing
> those items the same way as plain \conninfo does, but I think
> we're better off just making \conninfo+ produce a table and nothing
> else.
>

I have attached a new patch that now prints all info in tabular format for
\conninfo+. I have also made the table output dynamic, so if the connection
uses SSL, the columns in the table will expand accordingly.

```
$ bin/psql "port=5430 sslmode=require dbname=postgres" -x -h localhost

postgres=# \conninfo+
Connection Information
-[ RECORD 1 ]--------+-----------------------
Database             | postgres
Current User         | hunaid
Session User         | hunaid
Host                 | localhost
Host Address         | 127.0.0.1
Port                 | 5430
Protocol Version     | 3
SSL Connection       | yes
SSL Protocol         | TLSv1.3
Cipher               | TLS_AES_256_GCM_SHA384
Compression          | off
ALPN                 | postgresql
GSSAPI Authenticated | no
Client Encoding      | UTF8
Server Encoding      | UTF8
Backend PID          | 88803


$ bin/psql "port=5430 sslmode=disable dbname=postgres" -x -h localhost

postgres=# \conninfo+
Connection Information
-[ RECORD 1 ]--------+----------
Database             | postgres
Current User         | hunaid
Session User         | hunaid
Host                 | localhost
Host Address         | 127.0.0.1
Port                 | 5430
Protocol Version     | 3
SSL Connection       | no
GSSAPI Authenticated | no
Client Encoding      | UTF8
Server Encoding      | UTF8
Backend PID          | 88900


$ bin/psql "port=5430 sslmode=disable dbname=postgres" -x

postgres=# \conninfo+
Connection Information
-[ RECORD 1 ]--------+---------
Database             | postgres
Current User         | hunaid
Session User         | hunaid
Socket Directory     | /tmp
Port                 | 5430
Protocol Version     | 3
SSL Connection       | no
GSSAPI Authenticated | no
Client Encoding      | UTF8
Server Encoding      | UTF8
Backend PID          | 89035
```

I have also updated the documentation.

Regards,
Hunaid Sohail

Attachment: v34-0001-Add-psql-meta-command-conninfo.patch
Description: Binary data

Reply via email to