RE: Psql meta-command conninfo+

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

On Thu, Feb 29, 2024 at 10:02:21PM +0000, Maiquel Grassi wrote:
> Sorry for the delay. I will make the adjustments as requested soon.

Looking forward to it.

----//----

Hi Nathan!

Sorry for the delay, I was busy with other professional as well as personal activities.

I made all the changes you suggested. I removed the variables and started using
views "pg_stat_ssl" and "pg_stat_gssapi". I handled the PostgreSQL versioning regarding the views used.

Here's a brief demonstration of the result:

[postgres(at)localhost ~]$ /home/pgsql-17devel/bin/psql -E -x -p 5433

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

postgres=# \conninfo+
/******** QUERY *********/
SELECT
pg_catalog.current_database() AS "Database",
'postgres' AS "Authenticated User",
pg_catalog.system_user() AS "System User",
pg_catalog.current_user() AS "Current User",
pg_catalog.session_user() AS "Session User",
pg_catalog.pg_backend_pid() AS "Backend PID",
pg_catalog.inet_server_addr() AS "Server Address",
pg_catalog.current_setting('port') AS "Server Port",
pg_catalog.inet_client_addr() AS "Client Address",
pg_catalog.inet_client_port() AS "Client Port",
'/tmp' AS "Socket Directory",
CASE
WHEN
pg_catalog.inet_server_addr() IS NULL
AND pg_catalog.inet_client_addr() IS NULL
THEN NULL
ELSE '/tmp'
END AS "Host",
(SELECT gss_authenticated AS "GSSAPI"
FROM pg_catalog.pg_stat_gssapi
WHERE pid = pg_catalog.pg_backend_pid()),
ssl.ssl AS "SSL Connection",
ssl.version AS "SSL Protocol",
ssl.cipher AS "SSL Cipher",
NULL AS "SSL Compression"
FROM
pg_catalog.pg_stat_ssl ssl
WHERE
pid = pg_catalog.pg_backend_pid()
;
/************************/

Current Connection Information
-[ RECORD 1 ]------+---------
Database | postgres
Authenticated User | postgres
System User |
Current User | postgres
Session User | postgres
Backend PID | 29007
Server Address |
Server Port | 5433
Client Address |
Client Port |
Socket Directory | /tmp
Host |
GSSAPI | f
SSL Connection | f
SSL Protocol |
SSL Cipher |
SSL Compression |

Rergards,
Maiquel Grassi.

Attachment Content-Type Size
v20-0001-psql-meta-command-conninfo-plus.patch application/octet-stream 13.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-03-18 22:08:45 Re: Popcount optimization using AVX512
Previous Message Tom Lane 2024-03-18 22:04:55 Re: Built-in CTYPE provider