RE: Psql meta-command conninfo+

From: Maiquel Grassi <grassi(at)hotmail(dot)com(dot)br>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Erik Wienhold <ewie(at)ewie(dot)name>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Psql meta-command conninfo+
Date: 2024-02-09 15:33:23
Message-ID: CP8P284MB24963D11AD78926C02F22853EC4B2@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>Hmm, I noticed that this would call printSSLInfo() and printGSSInfo()
>after listConnectionInformation. It would be much better to show these
>in tabular format as well and remove the calls to printSSL/GSSInfo.
>
>I propose additional columns to the same \conninfo+ table; when SSL,
>like this:
>
>Database | postgres
>[...]
>Host | 127.0.0.1
>Encryption | SSL
>Protocol | PQsslAttribute(protocol)
>Cipher | PQsslAttribute(cipher)
>Compression | PQsslAttribute(compression)
>
>When GSS, like this
>
>Database | postgres
>[...]
>Host | 127.0.0.1
>Encryption | GSS
>
>(why don't we print anything else in printGSSInfo()? That's weird.)

--//--

Hi Álvaro,

Thank you for the suggestion. I will remove printSSLInfo() and printGSSInfo() and
incorporate the suggested fields into the tabular result of "\conninfo+".

If it's necessary to adjust printGSSInfo(), we can work on that as well. At first
glance, I leave it open for others to analyze and give their opinion.

I'd also like to ask for help with a difficulty. Currently, I'm working on

resolving this situation (highlighted by Pavel Luzanov). How can we
make \conninfo return the same message as \conninfo+ after closing
the current session in another session with pg_terminate_backend(pid)?

[postgres(at)localhost bin]$ ./psql

psql (17devel)
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/tmp" at port "5432".
postgres=# \conninfo+
Current Connection Information
Database | Authenticated User | System User | Current User | Session User | Backend PID | Server Address | Server Port | Client Address | Client Port | Socket Directory | Host
----------+--------------------+-------------+--------------+--------------+-------------+----------------+-------------+----------------+-------------+------------------+------
postgres | postgres | | postgres | postgres | 17281 | | 5432 | | | /tmp |
(1 row)

postgres=# 2024-02-09 09:15:24.152 -03 [17281] FATAL: terminating connection due to administrator command

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/tmp" at port "5432".
postgres=# \conninfo+
FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
postgres=#

Tks a lot!
Maiquel Grassi.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shubham Khanna 2024-02-09 16:02:05 Improve documentation of upgrade for streaming replication section.
Previous Message Masahiko Sawada 2024-02-09 15:22:37 Re: Improve eviction algorithm in ReorderBuffer