pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1e676702cac06e3d51942cc69efc282663515fba

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 ++++++++++++++++------------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 94 insertions(+), 36 deletions(-)



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

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 +++++++++++++++++-----------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 95 insertions(+), 35 deletions(-)



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

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/84b36063f4092c54f0cc628e6d9c684af6128d07

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 +++++++++++++++++-----------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 95 insertions(+), 35 deletions(-)



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

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 +++++++++++++++++-----------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 95 insertions(+), 35 deletions(-)



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

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/46e48c5607e97fcc9cccd38ae3cd96b952dc6bd0

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 +++++++++++++++++-----------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 95 insertions(+), 35 deletions(-)



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

* pgsql: Fix transition tables for MERGE with cross-partition UPDATEs.
@ 2026-11-18 16:05 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2026-11-18 16:05 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix transition tables for MERGE with cross-partition UPDATEs.

When a MERGE UPDATE action moved a row between partitions, the old and
new rows were not included in the transition tables of AFTER UPDATE
statement triggers, and could instead be incorrectly included in the
transition tables of AFTER INSERT and AFTER DELETE statement triggers.

Fix by capturing both halves of a cross-partition MERGE UPDATE action
in the UPDATE transition tables and exclude them from the DELETE and
INSERT transition tables, as we do for a plain UPDATE.

Backpatch to v15, where MERGE was introduced.

Reported-by: Michael Ries <mries@salesforce.com>
Reported-by: Tender Wang <tndrwang@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: shihao zhong <zhong950419@gmail.com>
Discussion: https://postgr.es/m/CAKWDHLgETF86qEW40HcEzMgn5DdmS6yR-nSYwemXF7zFGrU%2BsQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAHewXNk8MgaFMD87s%3DxHeguzmErEjsqeroxrMyQbKyXwG5eocw%40mail.gmail.com
Backpatch-through: 15

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 69 +++++++++++++++++-----------------
src/test/regress/expected/triggers.out | 31 +++++++++++++++
src/test/regress/sql/triggers.sql      | 30 +++++++++++++++
3 files changed, 95 insertions(+), 35 deletions(-)



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


end of thread, other threads:[~2026-11-18 16:05 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-18 16:05 pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. Dean Rasheed <dean.a.rasheed@gmail.com>

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