public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Noah Misch <[email protected]>
Cc: Michael Banck <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [PATCH] Add support for displaying database service in psql prompt
Date: Tue, 8 Jul 2025 08:52:08 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAKAnmmKhnHGp4X3FvMAicRsbyiKTWwMJ6oWdkRw2oLVzdeL-0A@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Sun, Jul 06, 2025 at 08:00:09PM -0700, Noah Misch wrote:
> I think the choice to make there is whether to call PQconninfo() once per
> prompt emission or to cache the value, invalidating that cache e.g. once per
> SyncVariables().  My first thought was to cache, but the decision is not too
> important.  A PQconninfo() call is likely negligible relative to all that
> happens between prompts.  Even if not negligible, the overhead of not caching
> will affect only prompts using the new escape sequence.

SyncVariables() happens at startup and when re-syncing a connection
during a check, so that does not really worry me.

By the way, there is a second change in the CF that's suggesting the
addition of a SERVICEFILE variable, which also uses a separate libpq
API (forgot about this one):
https://commitfest.postgresql.org/patch/5387/

Changing the patch on the other thread to use a conninfo is
stright-forward.  How about extending the get_service_name()@common.c
I've proposed upthread so as it takes a string in input and it could
be reused for more connection options than only "service" so as it
could be reused there as well?
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
  download

view thread (14+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Add support for displaying database service in psql prompt
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox