Re: Inconsistent trigger behavior between two temporal leftovers

Paul A Jungwirth <pj@illuminatedcomputing.com>

From: Paul A Jungwirth <pj@illuminatedcomputing.com>
To: Sergei Patiakin <sergei.patiakin@enterprisedb.com>
Cc: pgsql-hackers@lists.postgresql.org, Peter Eisentraut <peter@eisentraut.org>
Date: 2026-04-15T05:28:34Z
Lists: pgsql-hackers
On Wed, Apr 8, 2026 at 5:50 AM Sergei Patiakin
<sergei.patiakin@enterprisedb.com> wrote:
>
> Attaching a patch that makes the behavior more consistent.

Thank you for the bug report!

I agree this seems surprising. The asymmetry doesn't bother me per se,
but each insert should have its own copy of the original row. It
doesn't make sense for a trigger firing on one leftover to affect the
other.

I wrote a fix before I saw yours, but they are nearly the same. I
tried to share more code between the first & subsequent passes, but
it's hard to do with the mapping case. So the fix you have here looks
great to me.

Yours,

-- 
Paul              ~{:-)
pj@illuminatedcomputing.com



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix cross-leftover pollution in FOR PORTION OF insert triggers