pgsql: Fix cross-leftover pollution in FOR PORTION OF insert triggers

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix cross-leftover pollution in FOR PORTION OF insert triggers
Date: 2026-06-04 09:17:40
Message-ID: E1wV4Cq-0011B2-1W@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix cross-leftover pollution in FOR PORTION OF insert triggers

When we insert temporal leftovers after an UPDATE FOR PORTION OF, we
must make a new copy of the tuple before each insert. Otherwise, if
an insert trigger assigns to attributes of NEW, the second leftover
sees those changes.

Author: Sergei Patiakin <sergei(dot)patiakin(at)enterprisedb(dot)com>
Reviewed-by: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/CANE55rCqcse_pwXBMWhbj3_7XROb8Dks6%3DOLFmKy3bO3zDsCsg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/993a7aa0e4af0922ac86d8914e0e78fc38fb0daf

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 12 +++++++++
src/test/regress/expected/for_portion_of.out | 38 ++++++++++++++++++++++++++++
src/test/regress/sql/for_portion_of.sql | 38 ++++++++++++++++++++++++++++
3 files changed, 88 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-06-04 09:53:20 pgsql: Require UPDATE permission on FOR PORTION OF column
Previous Message Michael Paquier 2026-06-04 06:21:21 pgsql: libpq: Fix "servicefile" after fallback to system service file