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: Fix some edge cases with characteristics after COMMIT/ROLLBACK A
Date: Thu, 12 Nov 2026 22:55:42 +0000
Message-ID: <E1xRdhm-00000000UV0-0DbI@gemulon.postgresql.org> (raw)

Fix some edge cases with characteristics after COMMIT/ROLLBACK AND CHAIN

Certain combinations of transaction sequences with AND CHAIN failed to
preserve the top-transaction characteristics, in some cases:
* When a transaction block failed, the chained transaction used the
default characteristics, not the characteristics of the transaction
chaining from.
* When COMMIT AND CHAIN was issued in a subtransaction that had the idea
to switch read_only, the chained transaction inherited the read-only
state of the subtransaction, not of the top transaction.  The state is
reset when the subtransaction ends, like RELEASE.  The characteristics
are now saved once all the subtransactions are committed.

Narek has reported the first problem.  I have discovered the second
pattern while digging through this area of the code.  Tests are added
for all the patterns spotted.

Author: Narek Galstyan <narek.galstyan@enterprisedb.com>
Author: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAHsn6_z-ewqXWe2h--SK93AdnPSOvjvF9KLodWckFZKAjxcONw@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dfffe8da630de366aa39c99f933679c5847cf0c0

Modified Files
--------------
src/backend/access/transam/xact.c          | 18 +++++++
src/test/regress/expected/transactions.out | 76 ++++++++++++++++++++++++++++++
src/test/regress/sql/transactions.sql      | 34 +++++++++++++
3 files changed, 128 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1xRdhm-00000000UV0-0DbI@gemulon.postgresql.org>
Permalink:  ../E1xRdhm-00000000UV0-0DbI@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xRdhm-00000000UV0-0DbI@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix some edge cases with characteristics after COMMIT/ROLLBACK A
  In-Reply-To: <E1xRdhm-00000000UV0-0DbI@gemulon.postgresql.org>
  References: <E1xRdhm-00000000UV0-0DbI@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