RE: Psql meta-command conninfo+
Maiquel Grassi <grassi@hotmail.com.br>
From: Maiquel Grassi <grassi@hotmail.com.br>
To: "Imseih (AWS), Sami" <simseih@amazon.com>, Nathan Bossart <nathandbossart@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>, Pavel Luzanov <p.luzanov@postgrespro.ru>, Erik Wienhold <ewie@ewie.name>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-03-28T19:07:47Z
Lists: pgsql-hackers
Attachments
- v21-0001-psql-meta-command-conninfo-plus.patch (application/octet-stream) patch v21-0001
Hi Sami! (v21) First and foremost, thank you very much for the review. > 1/ I looked through other psql-meta commands and the “+” adds details but > does not change output format. In this patch, conninfo and conninfo+ > have completely different output. The former is a string with all the details > and the latter is a table. Should conninfo just be a table with the minimal info > and additional details can be displayed with "+" appended? The initial and central idea was always to keep the metacommand "\conninfo" in its original state, that is, to preserve the string as it is. The idea of "\conninfo+" is to expand this to include more information. If I change the "\conninfo" command and transform it into a table, I would have to remove all the translation part (files) that has already been implemented in the past. I believe that keeping the string and its translations is a good idea and there is no great reason to change that. > 2/ GSSAPI details should show the full details, such as "principal", > "encrypted" and "credentials_delegated". In this new patch, I added these columns. I handled the 'server versions' for cases where the 'credentials_delegated' column is not in the view. It turned out well. Thank you for the idea. 3/ A very nice to have is "Application Name", in the case one sets the application_name within a connection or in the connection string. I did the same here. I liked your idea and added this column in the SQL. Look below to see how it turned out after it's finished. Exemple 1: [postgres@localhost ~]$ /home/pgsql-17devel/bin/psql -x -p 5432 psql (17devel, server 15.6) 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 -[ RECORD 1 ]----------------+--------- Database | postgres Authenticated User | postgres System User | Current User | postgres Session User | postgres Application Name | psql Backend PID | 19439 Server Address | Server Port | 5432 Client Address | Client Port | Socket Directory | /tmp Host | SSL Connection | f SSL Protocol | SSL Cipher | SSL Compression | GSSAPI Authenticated | f GSSAPI Principal | GSSAPI Encrypted | f GSSAPI Credentials Delegated | Exemple 2: [postgres@localhost ~]$ /home/pgsql-17devel/bin/psql -x -p 5000 psql (17devel) Type "help" for help. postgres=# \conninfo You are connected to database "postgres" as user "postgres" via socket in "/tmp" at port "5000". postgres=# \conninfo+ Current Connection Information -[ RECORD 1 ]----------------+--------- Database | postgres Authenticated User | postgres System User | Current User | postgres Session User | postgres Application Name | psql Backend PID | 19468 Server Address | Server Port | 5000 Client Address | Client Port | Socket Directory | /tmp Host | SSL Connection | f SSL Protocol | SSL Cipher | SSL Compression | GSSAPI Authenticated | f GSSAPI Principal | GSSAPI Encrypted | f GSSAPI Credentials Delegated | f Regards, Maiquel Grassi.
Commits
-
psql: Change new \conninfo to use SSL instead of TLS
- 6d6480066c1a 18.0 landed
-
Change \conninfo to use tabular format
- bba2fbc6238b 18.0 landed
-
Update extension lookup routines to use the syscache
- d8df7ac5c04c 18.0 cited
-
Improve COPY TO performance when server and client encodings match
- b619852086ed 17.0 cited
-
doc: Remove superfluous bracket in synopsis
- fdfb92c0307c 17.0 cited
-
Remove psql support for server versions preceding 9.2.
- cf0cab868aa4 15.0 cited