From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: libpq error message refactoring
Date: Mon, 14 Nov 2022 11:11:49 +0100
Message-ID: <20221114101149.pgabiv4eqv4mivqf@alvherre.pgsql> (raw)
In-Reply-To: <8e795834-7c09-e204-97cd-c3b194ea64fb@enterprisedb.com>
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/
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: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, peter.eisentraut@enterprisedb.com
Subject: Re: libpq error message refactoring
In-Reply-To: <20221114101149.pgabiv4eqv4mivqf@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox