Improve error hint for already-modified rows under FOR PORTION OF

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Improve error hint for already-modified rows under FOR PORTION OF
Date: 2026-09-04 19:42:04
Message-ID: CA+renyWo297GUPjXgaU42J9Vg9SLFppa-=JMW-Qbx2Lcn59N_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Here is a fix for finding D7 from [0].

If a BEFORE trigger changes a row and then the main statement changes
the same row, we raise an error with a hint suggesting to use AFTER
triggers instead. But temporal leftovers fire BEFORE & AFTER triggers
while the statement is proceeding, so that hint may not be applicable.
This commit adds an errdetail when the top-level statement used FOR
PORTION OF.

[0] https://www.postgresql.org/message-id/CA%2BrenyV6QLOJYmLo3gbsg1Y%2BCrho8NqME1jJXgPbO_NgxfBaKQ%40mail.gmail.com

Yours,

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

Attachment Content-Type Size
v1-0001-Improve-the-error-hint-for-already-modified-rows-.patch text/x-patch 12.6 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Robert Haas 2026-09-04 19:40:29 Re: pg_*_advice: tsv load failure, etc.