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 <[email protected]> Author: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/cahsn6_z-ewqxwe2h--sk93adnpsovjvf9klodwckfzkajxc...@mail.gmail.com Backpatch-through: 15 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/dc9b5687c8db55a64dd9b3ebff966c9eb0f9198f 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(+)
