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

From Tender Wang
Subject Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error
Date
Msg-id CAHewXNmx+UXg46+WUrbPca91bmVipRTpe+SRm19GtxG6mArRhg@mail.gmail.com
Whole thread Raw
In response to BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error
Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error
List pgsql-bugs


Amit Langote <amitlangote09@gmail.com> 于2025年10月30日周四 16:29写道:


I am not really sure if we should play with the planner code.

I suspect the real issue is that we’re assuming partitioned tables
always need a ctid, which wasn’t true before MERGE started using the
root ResultRelInfo. In fact, the old code already looked wrong -- it’s
been requiring a ctid even for partitioned tables where that was never
necessary. We can fix this by only requiring the junk ctid when we
actually operate through the root partitioned table, that is, for
MERGE.  Like the attached.

With your patch, this issue didn't happen again.
But I still get a different output when I enable verbose in EXPLAIN,

Output: ctid (enable_partition_pruning = on)
vs 
Output: NULL::oid(enable_partition_pruning = off)

From the user's perspective, it's a bit confusing. 
I agree more with Tom’s opinion — we should throw an error like "cannot delete from foreign table p1"
But the plan only had a dummy root relation; CheckValidResultRel() doesn't work. 
Some other code place may need to do something.


--
Thanks,
Tender Wang

pgsql-bugs by date:

Previous
From: Lori Corbani
Date:
Subject: RE: [EXTERNAL]Re: BUG #19094: select statement on postgres 17 vs postgres 18 is returning different/duplicate results
Next
From: Amit Langote
Date:
Subject: Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error