Re: MERGE issues around inheritance - Mailing list pgsql-hackers

From Tender Wang
Subject Re: MERGE issues around inheritance
Date
Msg-id CAHewXNnWvAWO+2io2cpJ_xNrkyZr3QsX0pyeHNHyYJ69w__GpA@mail.gmail.com
Whole thread Raw
In response to Re: MERGE issues around inheritance  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: MERGE issues around inheritance
List pgsql-hackers


Dean Rasheed <dean.a.rasheed@gmail.com> 于2025年5月26日周一 04:10写道:
On Sun, 25 May 2025 at 13:41, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> On Sun, 25 May 2025 at 13:06, Tender Wang <tndrwang@gmail.com> wrote:
> >
> > For a partitioned table, we must pass rootResultRelInfo to ExecInsert(). I added the check before calling ExecInsert()
> > If it is a partitioned table, we continue to pass rootResultRelInfo. Otherwise, we pass resultRelInfo.
> > Please see the attached diff file. The patch passed all regression test cases.
> >
>
> No, I don't think that's the right fix. I'm looking at it now, and I
> think I have a fix, but it's more complicated than that. I'll post an
> update later.
>

The reason that MERGE must pass rootResultRelInfo to ExecInsert() for
a plain-inheritance table dates back to 387f9ed0a08. As that commit
demonstrates, it is possible for the parent to be excluded from the
plan, and so all of the entries in the resultRelInfo array may be for
different relations than rootResultRelInfo.

Hi Dean,

 "it is possible for the parent to be excluded from the
plan and so all of the entries in the resultRelInfo array may be for
different relations than rootResultRelInfo."

I didn't fully understand the above sentence.  Can you give me more information or an example?
If the parent is excluded from the plan, the first entry in the resultRelInfo array will not be the parent but some surviving child.


--
Thanks,
Tender Wang

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Custom GUCs and typos
Next
From: Amit Kapila
Date:
Subject: Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly