Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error - Mailing list pgsql-bugs

From Amit Langote
Subject Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error
Date
Msg-id CA+HiwqHt=b5GozQ-Z0Hnmdnbw7N1wyFxKzJ3Z27A0pd6gjFxKQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-bugs
On Fri, Nov 7, 2025 at 6:23 PM Amit Langote <amitlangote09@gmail.com> wrote:
> On Fri, Nov 7, 2025 at 6:05 PM Kirill Reshke <reshkekirill@gmail.com> wrote:
> > On Fri, 7 Nov 2025 at 11:02, Amit Langote <amitlangote09@gmail.com> wrote:
> > > I have another idea: we can simply recognize the corner condition that
> > > throws this error in ExecInitModifyTable() by checking if
> > > ModifyTable.resultRelations contains only the root partitioned table.
> > > That can only happen for UPDATE, DELETE, or MERGE when all child
> > > relations were excluded.
> > >
> > > Patch doing that attached.  Added test cases to file_fdw's suite.
> >
> > I think this is an OK option for backpatching.  After v2 applied, I
> > found the behavior of DELETE and EXPLAIN DELETE consistent.
>
> Thanks for the comment.
>
> > The only
> > remaining issue is VERBOSE output difference with or without
> > enable_partition_pruning (which is v19+ issue to worry about),
> > correct?
>
> Yes, iff we are to do anything at all about the difference.
>
> > Also, should we add  COSTS OFF to EXPLAIN in the regression test? I
> > understand that costs should be always zero, but COSTS OFF is almost
> > everywhere is tests
>
> Yeah, a good call.
>
> v3 attached.

Attached v4 where I have updated the commit message to mention 86dc9005.

The bug doesn’t seem critical enough to rush the fix, so I’ll hold off
on committing it for next week’s release to leave room for further
comments.

--
Thanks, Amit Langote

Attachment

pgsql-bugs by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: BUG #19103: Canceled INSERT statement can still influence the performance of subsequent SELECT statement
Next
From: Noah Misch
Date:
Subject: Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18