pgpool: Fix hang on deferred constraint errors in pipeline mode

From: Taiki Koshino <koshino(at)sraoss(dot)co(dot)jp>
To: pgpool-committers(at)lists(dot)postgresql(dot)org
Subject: pgpool: Fix hang on deferred constraint errors in pipeline mode
Date: 2026-09-18 05:29:57
Message-ID: E1x7RAb-0000000DJy3-1wRM@gothos.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-committers

Fix hang on deferred constraint errors in pipeline mode

PostgreSQL 19 and later include a psql_pipeline regression test for a
deferred constraint violation at commit time. When this test is run
through Pgpool-II, it hangs after reporting the constraint violation.

The test sends Sync at the end of a pipeline containing an INSERT into
a table with a DEFERRABLE INITIALLY DEFERRED primary key. PostgreSQL
detects the duplicate key while processing Sync and returns an
ErrorResponse.

Previously, read_kind_from_backend() removed the pending Sync message
when it received the ErrorResponse. ErrorResponse processing then
incorrectly concluded that Sync had not yet been received from the
frontend and waited for another Sync. Since psql had already sent Sync
as part of \endpipeline, both sides waited indefinitely and the
psql_pipeline test failed to complete.

Keep the pending Sync message in the queue when an ErrorResponse is
received. This allows error processing to recognize that Sync has
already been received and to continue processing through
ReadyForQuery. Test is also added.

Author: Taiki Koshino <koshino(at)srasoss(dot)co(dot)jp>
Discussion: https://www.postgresql.org/message-id/OS9P286MB6486B54CF8A848176B90539C94A42%40OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM
Backpatch-through: v4.3

Branch
------
V4_7_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=ec2e6f1154d70c455ac4f98d8bf8cd98dc84f97e

Modified Files
--------------
src/protocol/pool_process_query.c | 9 ++-
.../regression/tests/134.pipeline/pgproto.data | 11 ++++
src/test/regression/tests/134.pipeline/test.sh | 65 ++++++++++++++++++++++
3 files changed, 84 insertions(+), 1 deletion(-)

Browse pgpool-committers by date

  From Date Subject
Next Message Taiki Koshino 2026-09-18 05:30:12 pgpool: Fix hang on deferred constraint errors in pipeline mode
Previous Message Taiki Koshino 2026-09-18 05:29:03 pgpool: Fix hang on deferred constraint errors in pipeline mode