Fix cross-leftover pollution in FOR PORTION OF insert triggers

Peter Eisentraut <peter@eisentraut.org>

Commit: 993a7aa0e4af0922ac86d8914e0e78fc38fb0daf
Author: Peter Eisentraut <peter@eisentraut.org>
Date: 2026-06-04T09:13:16Z
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.patiakin@enterprisedb.com>
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/CANE55rCqcse_pwXBMWhbj3_7XROb8Dks6%3DOLFmKy3bO3zDsCsg%40mail.gmail.com

Files

Discussion