Re: libpq async duplicate error results

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-02-17T01:53:08Z
Lists: pgsql-hackers
Hi,

On 2022-02-16 20:28:02 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2022-02-16 18:51:37 -0500, Tom Lane wrote:
> >> +	/* Also, do nothing if the argument is OOM_result */
> >> +	if (res == unconstify(PGresult *, &OOM_result))
> >> +		return;
>
> > Wouldn't it make more sense to make res const, rather than unconstifying
> > &OOM_result?
>
> Uh ... then we'd have to cast away the const to do free().

I was just thinking of

if ((const PGresult *) res == &OOM_result)

It's not important, I just find it stylistically nicer (making a pointer const
from an non-const pointer is safe, the other way round not generally).

- Andres



Commits

  1. libpq: drop pending pipelined commands in pqDropConnection().

  2. Adjust interaction of libpq pipeline mode with errorMessage resets.

  3. Rearrange libpq's error reporting to avoid duplicated error text.

  4. In libpq, always append new error messages to conn->errorMessage.