Re: libpq error message refactoring - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: libpq error message refactoring
Date
Msg-id 20221114101149.pgabiv4eqv4mivqf@alvherre.pgsql
Whole thread Raw
In response to Re: libpq error message refactoring  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List 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/



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: A problem about join ordering
Next
From: Amit Kapila
Date:
Subject: Re: Time delayed LR (WAS Re: logical replication restrictions)