UPDATE/DELETE 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: UPDATE/DELETE FOR PORTION OF
Date: 2026-10-31 17:31:51
Message-ID: CA+renyULDQq3x-qYuADAenfqbFts9HaM66zWROZO8X+2bJf2GA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

Here is a new patch series for UPDATE/DELETE FOR PORTION OF, based on
feedback from the v19 cycle. It includes fixes for all the Open Items
and other things that were reported.

The biggest issue was isolation anomalies under READ COMMITTED. We can
detect these, so for now I am just reporting a serialization failure.
I plan to work on avoiding them entirely, but it may require a WITHOUT
OVERLAPS index to be present.

A couple of the bugs reported against FOR PORTION OF were pre-existing
and applied to master as well (and require backpatching). I've
included those here as prerequisites, but see [0] and [1] for their
separate threads.

I also included support for DO INSTEAD/DO ALSO rules and INSTEAD OF
triggers. In v19 these were deemed to be new features, so we just
forbade the combination. But I think the desired semantics are clear.
If you do something *instead* of the original query, then we should
skip inserting leftovers. But we should still hit only the targeted
rows and we should tighten the range in the NEW tuple. For DO ALSO we
should do everything the original query does, and again tighten the
range in the NEW tuple. I broke this work out into separate patches to
make review easier, but I think it can be squashed when committing.

I tried to include Co-authored-by/Reviewed-by/Discussion references
based on all the bug reports from v19. If that is excessive, please
let me know and I'll drop them from future versions.

[0] https://www.postgresql.org/message-id/CA%2BrenyXoVubKLxGf%3Dopu4ty_OYbEC1TkpX5rGfwDQpUiAga-%3DA%40mail.gmail.com
[1] https://www.postgresql.org/message-id/CA%2BrenyVvS8K0YypfwYfRNT8-8OHoDKPPNv%3DpcSC0RdZx%2BuV__w%40mail.gmail.com

Yours,

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

Attachment Content-Type Size
v1-0005-Allow-FOR-PORTION-OF-on-views-with-DO-ALSO-rules.patch text/x-patch 12.0 KB
v1-0001-Reject-whole-row-references-where-column-referenc.patch text/x-patch 10.9 KB
v1-0002-Free-the-tuple-fetched-for-BEFORE-INSTEAD-OF-row-.patch text/x-patch 3.2 KB
v1-0004-Apply-FOR-PORTION-OF-to-DO-INSTEAD-rules-on-views.patch text/x-patch 20.4 KB
v1-0003-Add-UPDATE-DELETE-FOR-PORTION-OF.patch text/x-patch 712.5 KB
v1-0006-Allow-FOR-PORTION-OF-on-views-with-INSTEAD-OF-tri.patch text/x-patch 26.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Roman Khapov 2026-10-31 17:37:07 pgbench aggregates final part can be missed at log
Previous Message Paul A Jungwirth 2026-10-31 17:20:22 Reject wholerow references where ColumnRef is forbidden