agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix assertion after aborting internal subtransaction at transact
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:29 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/999ce9bcd80890c3d723e113bb0337c900f9f249

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:29 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a87bc9ca2494cbc5a41a1ee506dac45c794d060

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:30 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:30 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/84287ab890ffed4cfe334019c2cb6abdaaf7c97f

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:30 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:30 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/11545bba7fd79c67bf4f0a953ac295700bb8615d

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix assertion after aborting internal subtransaction at transact
@ 2026-09-17 05:30 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-17 05:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assertion after aborting internal subtransaction at transaction end

Previously, aborting an internal subtransaction during COMMIT or
PREPARE TRANSACTION could cause the following assertion failure.
This could happen, for example, when a deferred constraint trigger fired
at COMMIT and its PL/pgSQL exception block caught an error raised
while executing the trigger function.

    TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState
    == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
    s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState ==
    TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455

An internal subtransaction should be able to be aborted while the parent
transaction is in the COMMIT or PREPARE TRANSACTION phase. However,
RollbackAndReleaseCurrentSubTransaction()'s assertion check previously
did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction
states, causing the assertion failure.

This commit fixes the assertion check by allowing those two parent
transaction states.

Backpatch to all supported versions.

Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Author: Patrick Reynolds <piki@planetscale.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com>
Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/access/transam/xact.c      |  2 ++
src/test/regress/expected/triggers.out | 28 ++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 25 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-09-17 05:30 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 05:29 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:29 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:30 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:30 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:30 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:30 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>
2026-09-17 05:30 pgsql: Fix assertion after aborting internal subtransaction at transact Fujii Masao <fujii@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox