Thread

  1. Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error

    Tender Wang <tndrwang@gmail.com> — 2025-10-30T11:08:26Z

    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