Improve error message of FOR PORTION OF violations of WITH CHECK OPTION

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 message of FOR PORTION OF violations of WITH CHECK OPTION
Date: 2026-09-04 20:51:07
Message-ID: CA+renyWWv28ZKOuPfihjx4WwpMipkka92VephKfGZzL0Ts6acQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

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

When FOR PORTION OF through a view violates WITH CHECK OPTION *both*
by the updated row and by the inserted temporal leftover, we show an
error complaining about the leftover. It would be clearer to show an
error about the top-level row. This commit moves the check a little
earlier (but still after constraints & uniqueness violations), when
FOR PORTION OF is used.

I think this patch would be simpler if we unconditionally shuffled the
order in ExecUpdateEpilogue to be (1) ExecWithCheckOptions, (2)
ExecForPortionOfLeftovers, (3) ExecARUpdateTriggers. I couldn't find
any problems there. But it felt too drastic so close to release. If
you'd like that patch instead, I'll send a revision.

[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-Report-the-user-s-row-not-a-leftover-for-FOR-PORT.patch text/x-patch 6.1 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Kirk Wolak 2026-09-04 20:22:49 Re: [PATCH v1 0/7] Wait event timing and tracing instrumentation