| From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix transition tables for MERGE with cross-partition UPDATEs. |
| Date: | 2026-11-18 16:05:53 |
| Message-ID: | E1xTiAS-00000000GQf-2T8I@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)salesforce(dot)com>
Reported-by: Tender Wang <tndrwang(at)gmail(dot)com>
Author: Tender Wang <tndrwang(at)gmail(dot)com>
Reviewed-by: shihao zhong <zhong950419(at)gmail(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-11-18 17:45:44 | pgsql: Fix formatting of to_char's EEEE output for numeric and bigint. |
| Previous Message | Melanie Plageman | 2026-11-18 16:02:36 | pgsql: Fix pgstattuple_approx handling of unknown tuple estimates |