public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Paul A Jungwirth <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix bug of UPDATE/DELETE FOR PORTION OF with inheritance tables
Date: Tue, 26 May 2026 14:55:01 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+renyV6BS+cUxAbxB1X-bBn8+9NDEwRah8pSD_EVdhtb1TcUA@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CA+renyV6BS+cUxAbxB1X-bBn8+9NDEwRah8pSD_EVdhtb1TcUA@mail.gmail.com>



> On May 26, 2026, at 07:01, Paul A Jungwirth <[email protected]> wrote:
> 
> On Fri, May 8, 2026 at 10:48 PM Chao Li <[email protected]> wrote:
>> 
>>> On May 7, 2026, at 11:40, Chao Li <[email protected]> wrote:
>>> After looking into the code, I found that leftover row insertion only considers the partitioned-table case, where leftovers need to be inserted through the root relation for partition routing. Plain inheritance is different, leftover rows should be inserted back into the actual child relation.
>>> 
>>> While debugging this, I also noticed another issue around mapping the range column’s attnum. In multiple-inheritance cases, the range column’s attnum in a child table may be different from the one in its parent, so we need to use the child’s actual attnum.
>>> 
>>> Please see the attached patch for the fix details and the new tests. Since I believe this bug was introduced in 19, I’m going to add it to the open items.
>>> 
>>> Best regards,
>>> --
>>> Chao Li (Evan)
>>> HighGo Software Co., Ltd.
>>> https://www.highgo.com/
>>> 
>>> 
>>> 
>>> 
>>> <v1-0001-Fix-FOR-PORTION-OF-leftovers-for-inheritance-chil.patch>
>> 
>> Merged into [1].
>> 
>> [1] https://postgr.es/m/CAHg+QDcd=t69gLf9yQexO07EJ2mx0Z70NFHo6h94X1EDA=hM0g@mail.gmail.com
> 
> Here is a new patch for this. I don't think it makes sense to combine
> it with the other fix anymore.
> 
> Per [1], we are now checking for UPDATE permission on the FOR PORTION
> OF column, so most of that other patch went away, and the fix here can
> be done independently. That's what v2 here does. I didn't really
> change anything from the v12-0002 patch on that other thread, except
> for moving some tests into the other patch (since they had nothing to
> do with traditional inheritance). The patch here now passes, whether
> applied to master directly or applied on top of v13 from the
> updatedCols fix. (Combining them will give a rebase conflict in the
> test files, but it's pretty trivial to fix.)
> 
> [1] https://www.postgresql.org/message-id/CA%2BrenyXyLfvtvVv--hGWGTgzFP%3D-%2BdPLy4RWvEmioAPyJMM%2Buw%40...
> 
> Yours,
> 
> -- 
> Paul              ~{:-)
> [email protected]
> <v2-0001-Fix-FOR-PORTION-OF-with-partitions-and-inheritanc.patch>

Now v2 mixes two separate changes:

1) Adding ExecInitForPortionOf() to address the UPDATE OF trigger issue
2) Fixing the inheritance/leftover bug originally reported in this thread

I’d prefer not to combine these in a single patch. Could you please split out the refactoring that adds ExecInitForPortionOf() into a separate patch, with tests showing that the UPDATE OF trigger issue is fixed? Then I can rework my inheritance/leftover fix on top of that.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/










view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Fix bug of UPDATE/DELETE FOR PORTION OF with inheritance tables
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox