Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tNSFF-00B8ar-IY for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Dec 2024 07:43:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tNSFC-00G8h6-0N for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Dec 2024 07:43:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tNSFA-00G8gw-Ra for pgsql-hackers@lists.postgresql.org; Tue, 17 Dec 2024 07:43:50 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tNSF5-003Fqq-9X for pgsql-hackers@lists.postgresql.org; Tue, 17 Dec 2024 07:43:48 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id CACCF2540139; Tue, 17 Dec 2024 02:43:41 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Tue, 17 Dec 2024 02:43:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1734421421; x=1734507821; bh=kRPVB81J07 blxQxidW315ur7bzdr7ELIp36q5xHUZDw=; b=FuPXTDbd4YfuazVEvy8MzuaRlO JNX5unm14lBy2c1BHWsuNXfbO5OfffyqoAEiGDq9SScibYIRz1Go8UFQw0KV+Z8W 2KD84Kz4sQ2eWvExaM5PCKHsZJ0IFRz/gvJQfKs3SzESzG28/eL+r9vqknvMBbpD pd/29zjZU16zhIBL1XC165KFtYttO8o2vTt6/uvcwFNctHiBLMQlGMLgs/3WgmDJ m7UBmlJmCmt4K48YfB1pt2dYnrefEFsjMrZZPCIjTX9tmUpwDXA7YE0p7HILZ4AD O1l+lUzRyixyeJ8r5WjgqclLngnEpYdIY8f+YT4sYCyYfFxuku6KWFSTVwqg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1734421421; x=1734507821; bh=kRPVB81J07blxQxidW315ur7bzdr7ELIp36 q5xHUZDw=; b=2rucr4mhNa85MbPLSbtFi8rDXIckzCXsoDBX2PwGLq6p5Lwfh3q le6ekAYk9G1VDxX6/0PGnAFwm2Hl0Dhvt28NwsVcUpcVNJVL+TI94fu1vWnRuPqP eljLRx+H8/Hqeb6JRdfeE4NMI55l6LEnJzWgYy5llI/nzFe3EnnTQiQ8zh+0dsub L7/kmRH17lZlo76LjGNj0YtVsSdat7aTgDiVQ9JNbcmQnximlyDOK8ekp5pPovgV JD2Ksl2cZ0JnJtn8J/W+oNZtNMI9/uxw49wchTXXBa8GDsYf0KKt6ESjGuKyLxNm fB6H8vhxYZC0xxyVFWJoShkHBsNB5ID5jtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrleeggdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepmhgsrghntghksehgmhigrdhnvghtpdhrtghpthhtohephhhtrghm fhhiughssehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsh eslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Dec 2024 02:43:39 -0500 (EST) Date: Tue, 17 Dec 2024 16:43:21 +0900 From: Michael Paquier To: Michael Banck Cc: Greg Sabino Mullane , PostgreSQL Hackers Subject: Re: [PATCH] Add support for displaying database service in psql prompt Message-ID: References: <6723c612.050a0220.1567f4.b94a@mx.google.com> <6748cfd4.050a0220.1537dc.43bb@mx.google.com> <6760a25e.a70a0220.2e9d8f.d542@mx.google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6trddDg5Zwe8vfKu" Content-Disposition: inline In-Reply-To: <6760a25e.a70a0220.2e9d8f.d542@mx.google.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6trddDg5Zwe8vfKu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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? + + The service from pg_service.conf, if applicab= le. + 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. =20 + + %s + The name of the service entry, if any. + Other entries don't use "if any", would just cut it. -- Michael --6trddDg5Zwe8vfKu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmdhK5kACgkQnvQgOdby QH0/ZQ/+IC8lIPhmbXTbWBgkP0gCb4cqcMfsYbpGorIQS5kfgB2kg6pmy34DeaX5 of1bnnh7ntXNj9neardWQvZrfzuNUNfqsHkJn7BoLfFq7/akXpz3Fkg9FOB1jjsr CBkGWqwfcmZl39U9xyPhQr3S07i7nDNOeyI4ETartlbhM1MYYIafn1ghxt+L49Cb 0uT2G8ztxXaIsVZWKDA7hiQQkEknCOM36OgBw9FuvmVhpFQ1WNP2XeDWSURZhiwe //n2o8kGHXcy8L8Rjpwm58sDFI+R6VFLBhkiF7mH2YMuEfDZx3zvr5Eues3TRtU6 O4EWaU7G6AoSabfoU9kCuUD7J7Fs44e07lDaIBKazLdN6NdE125cMr83diVuvuOs yozfVOqgvGD2skwxt7UJ6kH0jm9haiJenSJEdVyC4FQC7dBw9H3g5PQaHVMl7vec dSYZfH5LierTqa3xsdFSnAxmidVLToQFz1j01//U3HxlsNmqgHNBzqLMxW23/Rxc IyHZbIRIOPBECP+XRdETEKTH4lSXcoqwB8tv+Dte9doseJj7OjrFlfv1zDXwZJhL nMGa/34oEO/RrA9erqIT1BQdMWiptRVLF7IXJ02XB1Jur81PFJnZkzn0t/1YXqVo qpXIY/p4olgFfHk1fDp72MZYlrrVkbCguBcVdtebBRcaxc0YbRM= =ptBl -----END PGP SIGNATURE----- --6trddDg5Zwe8vfKu--