[PATCH] Add support for displaying database service in psql prompt

Michael Banck <mbanck@gmx.net>

From: Michael Banck <mbanck@gmx.net>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-10-31T18:01:54Z
Lists: pgsql-hackers

Attachments

Hi,

I think it might be useful to sometimes display the database service
(i.e. what is defined in ~/.pg_service.conf and used via psql
service=foo) in the psql prompt, e.g. if you have 'test' and 'prod'
services, but both have the same database name. This was also suggested
to me during a recent customer training.

I chose the '%s' tag for it. I had to add the service to PGConn as
PQservice (first patch) to libpq and then use it in psql in the second
patch.


Michael

Commits

  1. libpq: Remove PQservice()

  2. psql: Add more information about service name

  3. libpq: Add service name to PGconn and PQservice()