agora inbox for pgpool-committers@postgresql.org  
help / color / mirror / Atom feed
From: Taiki Koshino <koshino@sraoss.co.jp>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: Fix inconsistent internal transaction handling in Parse.
Date: Fri, 18 Sep 2026 05:17:48 +0000
Message-ID: <E1x7Qyq-0000000D5fr-1FGW@gothos.postgresql.org> (raw)

Fix inconsistent internal transaction handling in Parse.

Parse() started an internal transaction for a strict query in raw mode:

    if (!SL_MODE)
        if (is_strict_query(...))
            start_internal_transaction(...);

Bind() correctly limits the same operation to replication mode:

    if (REPLICATION)
        if (is_strict_query(...))
            start_internal_transaction(...);

This difference left an autocommitted extended-protocol UPDATE in a
transaction in raw mode because the internal transaction was never
closed.

Add the REPLICATION condition to Parse() to make it consistent with
Bind().

The issue was verified using pgproto with the following extended-query
message sequence:

    'P'  "s"  "UPDATE scm_pgpool_txn_probe SET value=value+1 WHERE id=1"  0
    'B'  ""   "s"  0  0  0
    'E'  ""   0
    'S'
    'Y'
    'X'

Before the fix, Pgpool-II returned:

    <= BE CommandComplete(UPDATE 1)
    <= BE ReadyForQuery(T)

After the fix, it returns:

    <= BE CommandComplete(UPDATE 1)
    <= BE ReadyForQuery(I)

Author: Taiki Koshino <koshino@sraoss.co.jp>
Discussion: https://github.com/pgpool/pgpool2/issues/172
Backpatch-through: v4.3

Branch
------
V4_7_STABLE

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

Modified Files
--------------
src/protocol/pool_proto_modules.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1x7Qyq-0000000D5fr-1FGW@gothos.postgresql.org>
Permalink:  ../E1x7Qyq-0000000D5fr-1FGW@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1x7Qyq-0000000D5fr-1FGW@gothos.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: pgpool-committers@postgresql.org
  Cc: koshino@sraoss.co.jp, pgpool-committers@lists.postgresql.org
  Subject: Re: pgpool: Fix inconsistent internal transaction handling in Parse.
  In-Reply-To: <E1x7Qyq-0000000D5fr-1FGW@gothos.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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox