Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouWRb-0000TU-Ff for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Nov 2022 10:11:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ouWRa-0002lb-CK for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Nov 2022 10:11:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouWRZ-0002lJ-95 for pgsql-hackers@lists.postgresql.org; Mon, 14 Nov 2022 10:11:58 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ouWRW-00020j-Fr for pgsql-hackers@postgresql.org; Mon, 14 Nov 2022 10:11:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D047C5C0035; Mon, 14 Nov 2022 05:11:52 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 14 Nov 2022 05:11:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1668420712; x=1668507112; bh=b 3/Qel5VhLl+Ua7SybMcG3F1MfqPbBOAw+aedHsosoc=; b=g1gm+4aoCTlv/SQB2 fjHZInSuXuxZthy0HiG/MG+MIjH1DK6LtAlkxBEVeF1pVjyM5nPDPQxEeKplzfaB 3tH5XsW4pjWH7gu5sbB246TaSj/ENm9s3BtefnxyMb1UP31bVq2ZicXKydWBB/cX J0RHjqOw3ST0ngJZbf3wAxbruabJzr9pyzyit5nST/DU/pAyf8nWIXvh0IBz2Km9 mILbmOjSmTa6lfvwOLUQDsdkuwcWuWc5rtqEw/wwlMfdTdOxZ0lkOZbiUX1jwyOI eVISzRw11yVvGOr09Q72ERXLeDhB7V+UiC8F1mnPaZFUWdkyZjB4/VrFcXVchcj9 fGasQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedugddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 05:11:52 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id BE4AD39B; Mon, 14 Nov 2022 11:11:49 +0100 (CET) Date: Mon, 14 Nov 2022 11:11:49 +0100 From: Alvaro Herrera To: Peter Eisentraut Cc: pgsql-hackers Subject: Re: libpq error message refactoring Message-ID: <20221114101149.pgabiv4eqv4mivqf@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8e795834-7c09-e204-97cd-c3b194ea64fb@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Nov-13, Peter Eisentraut wrote: > On 09.11.22 13:29, Alvaro Herrera wrote: > > > + /* Loop in case we have to retry after enlarging the buffer. */ > > > + do > > > + { > > > + errno = save_errno; > > > + va_start(args, fmt); > > > + done = appendPQExpBufferVA(errorMessage, libpq_gettext(fmt), args); > > > > I wonder if it makes sense to do libpq_gettext() just once, instead of > > redoing it on each iteration. > > I wonder whether that would expose us to potential compiler warnings about > the format string not being constant. As long as the compiler can trace > that the string comes from gettext, it knows what's going on. > > Also, most error strings in practice don't need the loop, so maybe it's not > a big issue. True. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/