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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Michael Banck <mbanck(at)gmx(dot)net>
Cc: Greg Sabino Mullane <htamfids(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add support for displaying database service in psql prompt
Date: 2024-12-17 07:43:21
Message-ID: Z2ErmZD1lImYt_as@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 16, 2024 at 10:57:49PM +0100, Michael Banck wrote:
> Thanks, I have added the documentation now in v2.

The doc additions seem fine to me. I've just grabbed three tiny nits,
nothing critical.

+ case 's':
+ if (PQservice(pset.db))
+ strlcpy(buf, PQservice(pset.db), sizeof(buf));
+ break;

Other code paths of get_prompt check for pset.db being NULL. True
that it does not matter when calling PQservice() with a connection
that does not exist. For consistency with the surroundings this
should be done at least?

+ <para>
+ The service from <filename>pg_service.conf</filename>, if applicable.
+ </para>

pg_service.conf is not especially true as it depends on the
environment used. For psql, perhaps just use "The service name, if
applicable". No need to be fancy.

--- a/src/interfaces/libpq/exports.txt
+++ b/src/interfaces/libpq/exports.txt
@@ -205,3 +205,4 @@ PQcancelFinish 202
[...]
+PQservice 206

You didn't miss that, nice.

+ <varlistentry id="app-psql-prompting-s">
+ <term><literal>%s</literal></term>
+ <listitem><para>The name of the service entry, if any.</para></listitem>
+ </varlistentry>

Other entries don't use "if any", would just cut it.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-12-17 07:50:45 Re: Crash: invalid DSA memory alloc request
Previous Message Evgeny Voropaev 2024-12-17 07:28:07 Re: Add 64-bit XIDs into PostgreSQL 15