Re: BUG #19494: Error on transaction commit inside pipeline triggers psql's Assert

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2026-05-29T05:00:20Z
Lists: pgsql-bugs

Attachments

On Fri, May 29, 2026 at 07:00:01AM +0300, Alexander Lakhin wrote:
> it's happening upon/after postgres process termination, so PQgetResult()
> returns NULL, pset.piped_syncs == 1. I need more time to look deeper and
> to come with a reproducer, but maybe you can already see what's wrong.

Yeah, I do.  Nice catch.  See this sequence to reproduce the problem:
\startpipeline
INSERT INTO psql_pipeline_defer VALUES (1), (1) \bind \sendpipeline
\syncpipeline
SELECT pg_terminate_backend(pg_backend_pid()) \bind \sendpipeline
SELECT 1 \bind \sendpipeline
\endpipeline

When ending the pipeline the loop consuming the results is stuck, so
we could check the connection state.  We are going to enter in a
freeze of the branches due to beta1 next week, so let's take our time.

Please feel to use the v2 attached for your tests.  I am also testing
it more on my side.
--
Michael

Commits

  1. psql: Fix issues with deferred errors in pipelines