pgsql: Fix assertion failures in DELETE FOR PORTION OF tuple routing

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assertion failures in DELETE FOR PORTION OF tuple routing
Date: 2026-09-01 19:19:04
Message-ID: E1x1U0d-000000034o2-30Yh@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assertion failures in DELETE FOR PORTION OF tuple routing

We must handle cases where an inserted temporal leftover gets routed to
a different partition than the original tuple's. This happens if the
partition key depends on the application-time column used in the FOR
PORTION OF clause. Everything works for UPDATE, but for DELETE we can
hit some Asserts, since that operation never needed to be covered
before. One Assert is for the RETURNING list; the other, for WITH CHECK
OPTION. This commit updates both to include CMD_DELETE.

Author: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Reported-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Discussion: https://postgr.es/m/03276924-6d55-470d-8192-a49c053c940f@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/610976420a331ab007621ae30f664d17c8d2eebe

Modified Files
--------------
src/backend/executor/execPartition.c | 22 +++++++---
src/test/regress/expected/for_portion_of.out | 59 +++++++++++++++++++++++++++
src/test/regress/expected/updatable_views.out | 45 ++++++++++++++++++++
src/test/regress/sql/for_portion_of.sql | 42 +++++++++++++++++++
src/test/regress/sql/updatable_views.sql | 33 +++++++++++++++
5 files changed, 195 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-09-01 19:21:46 pgsql: Fix spurious errors in COPY FROM (FORMAT {text,csv}).
Previous Message Andres Freund 2026-09-01 18:50:24 pgsql: Make after-startup shmem failure test reliable