Adjust interaction of libpq pipeline mode with errorMessage resets.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Feb 2022 16:31:30 +0000 (11:31 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Feb 2022 16:31:30 +0000 (11:31 -0500)
commitb15f254466aefbabcbed001929f6e09db59fd158
tree0a21ae60b3728ae8218f2140f640bec7ad40e357
parentfbee60f6a4ff2561f5a5af23959a29967f53fbde
Adjust interaction of libpq pipeline mode with errorMessage resets.

Since commit ffa2e4670, libpq resets conn->errorMessage only when
starting a new query.  However, the later introduction of pipelining
requires a further refinement: the "start of query" isn't necessarily
when it's submitted to PQsendQueryStart.  If we clear at that point
then we risk dropping text for an error that the application has not
noticed yet.  Instead, when queuing a query while a previous query is
still in flight, leave errorMessage alone; reset it when we begin
to process the next query in pqPipelineProcessQueue.

Perhaps this should be back-patched to v14 where ffa2e4670 came in.
However I'm uncertain about whether it interacts with 618c16707.
In the absence of user complaints, leave v14 alone.

Discussion: https://postgr.es/m/1421785.1645723238@sss.pgh.pa.us
src/interfaces/libpq/fe-exec.c