Re: libpq error message refactoring

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq error message refactoring
Date: 2022-11-14 10:11:49
Message-ID: 20221114101149.pgabiv4eqv4mivqf@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-11-14 10:15:23 Re: Time delayed LR (WAS Re: logical replication restrictions)
Previous Message Richard Guo 2022-11-14 10:10:31 Re: A problem about join ordering