Re: libpq async duplicate error results

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-02-23T23:15:07Z
Lists: pgsql-hackers
I wrote:
> However ... in the wake of 618c16707, I wonder if we should consider
> an alternative definition, which is to NOT clear errorMessage when
> starting a new pipelined query.  (That would be this patch minus
> the addition to pqPipelineProcessQueue.)  Thanks to 618c16707,
> the returned error PGresult(s) should bear exactly the same contents
> either way.  What would change is that PQerrorMessage(conn) would return
> the concatenation of all errors that have occurred during the current
> pipeline sequence.  I think that's arguably a more useful definition
> than what we have now --- though obviously it'd require a docs change.
> It seems to fit with the spirit of the v14 changes to ensure that
> PQerrorMessage tells you about everything that happened during a
> failed connection attempt, not only the last thing.

After studying the pipeline mode some more, I no longer think that's
a great idea.  ISTM we want pipeline mode to act as nearly as possible
the same as issuing the same series of queries non-pipelined.   But
this redefinition would make it different.  So, barring objection,
I'll push that cleanup patch as-posted.

			regards, tom lane



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.