Re: [PATCH v1] Fix hang on deferred constraint errors in pipeline mode

From: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: "pgpool-hackers(at)lists(dot)postgresql(dot)org" <pgpool-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH v1] Fix hang on deferred constraint errors in pipeline mode
Date: 2026-09-04 06:33:22
Message-ID: OS9P286MB6486CDDF1CAB5B63A3817FFD94B52@OS9P286MB6486.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgpool-hackers

> The patch looks good to me. One request: can you consider to add a
> regression test for this? The patched module is one of the critical
> part of Pgpool-II. We want to detect a regression as early as possible
> in the event of other modifications to the function.

Thank you for reviewing.

I added a regression test under
src/test/regression/tests/134.pipeline.

The test uses pgproto to trigger a deferred unique constraint violation
while processing Sync. It verifies that pgproto does not time out and
that processing continues from ErrorResponse through ReadyForQuery.

Regards,
Taiki Koshino

Taiki Koshino<koshino(at)sraoss(dot)co(dot)jp>
SRA OSS K.K.
TEL: 03-5979-2701 FAX: 03-5979-2702
URL: https://www.sraoss.co.jp/

________________________________
差出人: Tatsuo Ishii <ishii(at)postgresql(dot)org>
送信日時: 2026年8月27日 9:01
宛先: Koshino Taiki <koshino(at)sraoss(dot)co(dot)jp>
CC: pgpool-hackers(at)lists(dot)postgresql(dot)org <pgpool-hackers(at)lists(dot)postgresql(dot)org>
件名: Re: [PATCH v1] Fix hang on deferred constraint errors in pipeline mode

Thank you for the patch!

> Hi,
>
> When PostgreSQL 19's psql_pipeline regression test is run through
> Pgpool-II,
> it can hang after a deferred constraint violation is
> reported at commit time.
>
> The attached patch fixes the issue by keeping the pending Sync message
> in the queue when an ErrorResponse is received,
> allowing processing to
> continue through ReadyForQuery.
>
> I have confirmed that the patch applies to
> master and V4_7_STABLE through V4_3_STABLE.

The patch looks good to me. One request: can you consider to add a
regression test for this? The patched module is one of the critical
part of Pgpool-II. We want to detect a regression as early as possible
in the event of other modifications to the function.

Here is a test case using pgproto.

'Q' "DROP TABLE psql_pipeline_defer"
'Y'
'Q' "CREATE TABLE psql_pipeline_defer (a INTEGER PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)"
'Y'
'P' "" "INSERT INTO psql_pipeline_defer VALUES (1),(1) RETURNING *"
'B' "" "" 0 0 0
'D' 'P' ""
'E' "" 0
'S'
'Y'
'X'

To detect the hang, you could use "timeout 1 pgproto...".
See src/test/regression/tests/006.memqcache/test.sh for similar idea.

Regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

Attachment Content-Type Size
v2-0001-Fix-hang-on-deferred-constraint-errors-in-pipelin.patch application/octet-stream 5.4 KB

In response to

Browse pgpool-hackers by date

  From Date Subject
Next Message Ernesto Montilva 2026-09-07 14:59:56 50-60ms per-query overhead in PgPool-II 4.7 vs direct connection
Previous Message Midnya 2026-09-03 17:39:38 Re: Report replication delay as unknown for down standby nodes