pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: psql: Fix assertion failures with pipeline mode
Date: Thu, 24 Apr 2025 03:23:47 +0000
Message-ID: <E1u7nBi-001VIu-2d@gemulon.postgresql.org> (raw)

psql: Fix assertion failures with pipeline mode

A correct cocktail of COPY FROM, SELECT and/or DML queries and
\syncpipeline was able to break the logic in charge of discarding
results of a pipeline, done in discardAbortedPipelineResults().  Such
sequence make the backend generate a FATAL, due to a protocol
synchronization loss.

This problem comes down to the fact that we did not consider the case of
libpq returning a PGRES_FATAL_ERROR when discarding the results of an
aborted pipeline.  The discarding code is changed so as this result
status is handled as a special case, with the caller of
discardAbortedPipelineResults() being responsible for consuming the
result.

A couple of tests are added to cover the problems reported, bringing an
interesting gain in coverage as there were no tests in the tree covering
the case of protocol synchronization loss.

Issue introduced by 41625ab8ea3d.

Reported-by: Alexander Kozhemyakin <a.kozhemyakin@postgrespro.ru>
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/ebf6ce77-b180-4d6b-8eab-71f641499ddf@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3631612eae9c2def99151c4f36b1b3771f53cba7

Modified Files
--------------
src/bin/psql/common.c       | 17 +++++++++++++++++
src/bin/psql/t/001_basic.pl | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)



Message-ID: <E1u7nBi-001VIu-2d@gemulon.postgresql.org>
Permalink:  ../E1u7nBi-001VIu-2d@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1u7nBi-001VIu-2d@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: psql: Fix assertion failures with pipeline mode
  In-Reply-To: <E1u7nBi-001VIu-2d@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox