From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Michael Banck <mbanck(at)gmx(dot)net>, 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: | 2025-07-07 02:06:06 |
Message-ID: | aGsrjkNUaqmDgbK8@paquier.xyz |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Jul 06, 2025 at 09:13:19AM -0700, Noah Misch wrote:
> This new PQservice() function from commit 4b99fed75 came up in the annual
> exports.txt diff. The standard in libpq has been to not clutter the API with
> new functions that simply retrieve one PQconninfoOption value. PQconninfo()
> provides access to all those values in a generic way. What do you think of
> making psql use PQconninfo() for this, then removing PQservice()? The rest of
> the commit (adding the struct field, necessary for PQconninfo() to include the
> value) looks good.
Sure, I was not aware of such a policy. Relying on PQconninfoOption
is less efficient because we would need to look through the whole set
of options when looking for the service name, and this needs one extra
allocation as PQconninfoFree() frees the values allocated. With two
callers perhaps this inefficiency is OK to live with anyway.
What do you think about the attached, then?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
pqservice-removal.patch | text/x-diff | 5.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | wenhui qiu | 2025-07-07 02:11:57 | Re: Making pg_rewind faster |
Previous Message | Peter Geoghegan | 2025-07-07 00:22:21 | Saving stack space in nbtree's _bt_first function |