Re: MERGE issues around inheritance

2025-05-28 Thread Tender Wang
Dean Rasheed 于2025年5月28日周三 18:26写道: > On Mon, 26 May 2025 at 12:50, Tender Wang wrote: > > > >> > "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." > >> > > >> >

Re: MERGE issues around inheritance

2025-05-28 Thread Dean Rasheed
On Mon, 26 May 2025 at 12:50, Tender Wang wrote: > >> > "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 y

Re: MERGE issues around inheritance

2025-05-26 Thread Tender Wang
Dean Rasheed 于2025年5月26日周一 18:41写道: > On Mon, 26 May 2025 at 07:46, Tender Wang wrote: > > > > 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." > > >

Re: MERGE issues around inheritance

2025-05-26 Thread Dean Rasheed
On Mon, 26 May 2025 at 10:39, Tender Wang wrote: > > jian he 于2025年5月26日周一 17:30写道: >> >> + Relation rootRelation = rootRelInfo->ri_RelationDesc; >> + Relation firstResultRel = mtstate->resultRelInfo[0].ri_RelationDesc; >> + int firstVarno = mtstate->resultRelInfo[0].ri_RangeTableIndex; >> >> fir

Re: MERGE issues around inheritance

2025-05-26 Thread Dean Rasheed
On Mon, 26 May 2025 at 07:46, Tender Wang wrote: > > 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

Re: MERGE issues around inheritance

2025-05-26 Thread Dean Rasheed
On Mon, 26 May 2025 at 10:30, jian he wrote: > > + Relation rootRelation = rootRelInfo->ri_RelationDesc; > + Relation firstResultRel = mtstate->resultRelInfo[0].ri_RelationDesc; > + int firstVarno = mtstate->resultRelInfo[0].ri_RangeTableIndex; > > firstResultRel may equal (==) to rootRelation, >

Re: MERGE issues around inheritance

2025-05-26 Thread jian he
On Mon, May 26, 2025 at 4:11 AM Dean Rasheed wrote: > > On Sun, 25 May 2025 at 13:41, Dean Rasheed wrote: > > > > 2. ExecInitModifyTable() does not initialize the WCO lists or > RETURNING list for rootResultRelInfo, so those never get executed. > > As it happens, it is possible to construct cases

Re: MERGE issues around inheritance

2025-05-26 Thread Tender Wang
jian he 于2025年5月26日周一 17:30写道: > On Mon, May 26, 2025 at 4:11 AM Dean Rasheed > wrote: > > > > On Sun, 25 May 2025 at 13:41, Dean Rasheed > wrote: > > > > > > > 2. ExecInitModifyTable() does not initialize the WCO lists or > > RETURNING list for rootResultRelInfo, so those never get executed. >

Re: MERGE issues around inheritance

2025-05-26 Thread Tender Wang
Dean Rasheed 于2025年5月26日周一 04:10写道: > On Sun, 25 May 2025 at 13:41, Dean Rasheed > wrote: > > > > On Sun, 25 May 2025 at 13:06, Tender Wang wrote: > > > > > > For a partitioned table, we must pass rootResultRelInfo to > ExecInsert(). I added the check before calling ExecInsert() > > > If it is

Re: MERGE issues around inheritance

2025-05-25 Thread Tender Wang
Dean Rasheed 于2025年5月26日周一 04:10写道: > On Sun, 25 May 2025 at 13:41, Dean Rasheed > wrote: > > > > On Sun, 25 May 2025 at 13:06, Tender Wang wrote: > > > > > > For a partitioned table, we must pass rootResultRelInfo to > ExecInsert(). I added the check before calling ExecInsert() > > > If it is

Re: MERGE issues around inheritance

2025-05-25 Thread Dean Rasheed
On Sun, 25 May 2025 at 13:41, Dean Rasheed wrote: > > On Sun, 25 May 2025 at 13:06, Tender Wang 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 rootResu

Re: MERGE issues around inheritance

2025-05-25 Thread Dean Rasheed
On Sun, 25 May 2025 at 13:06, Tender Wang 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 th

Re: MERGE issues around inheritance

2025-05-25 Thread Tender Wang
Tender Wang 于2025年5月25日周日 19:17写道: > > > Álvaro Herrera 于2025年5月24日周六 17:11写道: > >> On 2025-May-21, Andres Freund wrote: >> >> > Hi, >> > >> > In [1] I added some verification to projection building, to check if the >> > tupleslot passed to ExecBuildProjectionInfo() is compatible with the >> tar

Re: MERGE issues around inheritance

2025-05-25 Thread Tender Wang
Álvaro Herrera 于2025年5月24日周六 17:11写道: > On 2025-May-21, Andres Freund wrote: > > > Hi, > > > > In [1] I added some verification to projection building, to check if the > > tupleslot passed to ExecBuildProjectionInfo() is compatible with the > target > > list. One query in merge.sql [2] got flagg

Re: MERGE issues around inheritance

2025-05-24 Thread Álvaro Herrera
On 2025-May-21, Andres Freund wrote: > Hi, > > In [1] I added some verification to projection building, to check if the > tupleslot passed to ExecBuildProjectionInfo() is compatible with the target > list. One query in merge.sql [2] got flagged. > > Trying to debug that issue, I found another p