Re: Fix bug of UPDATE/DELETE FOR PORTION OF with inheritance tables

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>
Subject: Re: Fix bug of UPDATE/DELETE FOR PORTION OF with inheritance tables
Date: 2026-05-27 01:28:51
Message-ID: CA+renyXQYOU6hRymFOd26fkvVLNmdFvvMsAzsaJUOCsKveLUQw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 26, 2026 at 9:14 AM Paul A Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> I thought the ExecInitForPortionOf refactoring was still nice to keep,
> and it seemed to fit better here. (I should have updated the commit
> message not to mention UPDATE OF though.)

I looked at the original v1 patch again. I thought the commit message
was excellent, so I pulled that into the latest patch, also some
comment changes and the partitionRouting boolean and some test
double-checks. I still like how ExecInitForPortionOf cuts down on the
branchiness and the variables used to track attnums, and also how it
gathers a lot of the child table setup in one place. The v1 seemed
hard to trace all the cases from top to bottom. For instance it
initialized map for all child tables, but then only used it for
partitions.

> But thinking about it this morning, I realized: the planner already
> prunes partitions before we get here. Lazily initializing the structs
> is trying too hard. Is there some scenario where that actually saves
> work?

Never mind, of course you can filter rows (and whole tables) besides
just by partition pruning/constraint exclusion.

I'm not sure whom to list as author/co-author/reviewer for this patch,
but I took a stab at it. I think most of the current code is from jian
he's version, but all three of us have contributed a lot by this
point.

Yours,

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

Attachment Content-Type Size
v3-0001-Fix-FOR-PORTION-OF-for-inheritance-children.patch text/x-patch 21.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-05-27 01:37:30 Re: pg_createsubscriber: Fix incorrect handling of cleanup flags
Previous Message Michael Paquier 2026-05-27 01:09:39 Re: NULL pointer dereference in syslogger with load_libraries() and -DEXEC_BACKEND at startup