RE: Psql meta-command conninfo+

From: Maiquel Grassi <grassi(at)hotmail(dot)com(dot)br>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: 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-02-06 21:39:20
Message-ID: CP8P284MB249627ACFC116EA2BC99DCC4EC462@CP8P284MB2496.BRAP284.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 06, 2024 at 08:52:09PM +0000, Maiquel Grassi wrote:
> I made the adjustment in the code and updated the patch. I believe this
> is the format suggested by you all. Would this be it?

I was thinking something more like

SELECT pg_catalog.current_database() AS "Database",
current_user AS "User",
pg_catalog.current_setting('server_version') AS "Server Version",
pg_catalog.inet_server_addr() AS "Server Address",
pg_catalog.current_setting('port') AS "Port",
pg_catalog.inet_client_addr() AS "Client Address",
pg_catalog.inet_client_port() AS "Client Port",
pg_catalog.pg_backend_pid() AS "Session PID";

--//--

Good, I had misunderstood. I liked this adjustment. Now it truly aligns with the central idea of the other extended meta-commands.

[postgres(at)localhost bin]$ ./psql -h 192.168.0.220 -p 5433 -U postgres -d postgres
psql (17devel, server 16.1)
Type "help" for help.

postgres=# \conninfo+
Current Connection Information
Database | User | Server Version | Server Address | Port | Client Address | Client Port | Session PID
----------+----------+----------------+----------------+------+----------------+-------------+-------------
postgres | postgres | 16.1 | 192.168.0.220 | 5433 | 192.168.0.220 | 57112 | 22120
(1 row)

postgres=# \q
[postgres(at)localhost bin]$ ./psql
psql (17devel)
Type "help" for help.

postgres=# \conninfo+
Current Connection Information
Database | User | Server Version | Server Address | Port | Client Address | Client Port | Session PID
----------+----------+----------------+----------------+------+----------------+-------------+-------------
postgres | postgres | 17devel | | 5432 | | | 31430
(1 row)

postgres=# \q
[postgres(at)localhost bin]$ ./psql -h localhost
psql (17devel)
Type "help" for help.

postgres=# \conninfo+
Current Connection Information
Database | User | Server Version | Server Address | Port | Client Address | Client Port | Session PID
----------+----------+----------------+----------------+------+----------------+-------------+-------------
postgres | postgres | 17devel | ::1 | 5432 | ::1 | 46918 | 31433
(1 row)

postgres=# \q
[postgres(at)localhost bin]$ ./psql -h 127.0.0.1
psql (17devel)
Type "help" for help.

postgres=# \conninfo+
Current Connection Information
Database | User | Server Version | Server Address | Port | Client Address | Client Port | Session PID
----------+----------+----------------+----------------+------+----------------+-------------+-------------
postgres | postgres | 17devel | 127.0.0.1 | 5432 | 127.0.0.1 | 34970 | 31435
(1 row)

Regards,
Maiquel O. Grassi.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Maiquel Grassi 2024-02-06 21:45:54 RE: Psql meta-command conninfo+
Previous Message Peter Eisentraut 2024-02-06 21:31:39 Re: Where can I find the doxyfile?