pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18871: Cross-partition MERGE fails with unclear internal error
7+ messages / 4 participants
[nested] [flat]

* BUG #18871: Cross-partition MERGE fails with unclear internal error
@ 2025-03-28 05:00 PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: PG Bug reporting form @ 2025-03-28 05:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: exclusion@gmail.com

The following bug has been logged on the website:

Bug reference:      18871
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 17.4
Operating system:   Ubuntu 24.04
Description:        

The following script:
CREATE TABLE pt(a int, b int) PARTITION BY LIST(a);
CREATE TABLE p1 PARTITION OF pt FOR VALUES IN (a);

MERGE INTO pt USING (SELECT 2 AS a) AS q ON pt.a = q.a
    WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
    WHEN MATCHED THEN DO NOTHING;
fails with:
ERROR:  XX000: unknown action in MERGE WHEN clause
LOCATION:  ExecInitPartitionInfo, execPartition.c:962

This error is triggered on REL_15_STABLE (starting from bf5c4b3d9) ..
master.
Before bf5c4b3d9, the MERGE produced ERROR:  variable not found in subplan
target lists.

This anomaly is discovered with SQLsmith.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
@ 2025-03-28 16:39 ` Tender Wang <tndrwang@gmail.com>
  2025-03-28 18:29   ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Tender Wang @ 2025-03-28 16:39 UTC (permalink / raw)
  To: exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> 于2025年3月28日周五 22:49写道:

> The following bug has been logged on the website:
>
> Bug reference:      18871
> Logged by:          Alexander Lakhin
> Email address:      exclusion@gmail.com
> PostgreSQL version: 17.4
> Operating system:   Ubuntu 24.04
> Description:
>
> The following script:
> CREATE TABLE pt(a int, b int) PARTITION BY LIST(a);
> CREATE TABLE p1 PARTITION OF pt FOR VALUES IN (a);
>
> MERGE INTO pt USING (SELECT 2 AS a) AS q ON pt.a = q.a
>     WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
>     WHEN MATCHED THEN DO NOTHING;
> fails with:
> ERROR:  XX000: unknown action in MERGE WHEN clause
> LOCATION:  ExecInitPartitionInfo, execPartition.c:962
>
> This error is triggered on REL_15_STABLE (starting from bf5c4b3d9) ..
> master.
> Before bf5c4b3d9, the MERGE produced ERROR:  variable not found in subplan
> target lists.
>
> This anomaly is discovered with SQLsmith.
>

I tried a quick fix by adding "case CMD_NOTHING" after "case CMD_DELETE"
like below:

case CMD_DELETE:
case CMD_NOTHING:
       break;

It can work, and all regression tests pass.  But I don't look into more
details.  This solution may not fix the root cause.


-- 
Thanks,
Tender Wang

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
@ 2025-03-28 18:29   ` Dean Rasheed <dean.a.rasheed@gmail.com>
  2025-03-29 02:39     ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Dean Rasheed @ 2025-03-28 18:29 UTC (permalink / raw)
  To: Tender Wang <tndrwang@gmail.com>; +Cc: exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

On Fri, 28 Mar 2025 at 16:40, Tender Wang <tndrwang@gmail.com> wrote:
>
> I tried a quick fix by adding "case CMD_NOTHING" after "case CMD_DELETE" like below:
>
> case CMD_DELETE:
> case CMD_NOTHING:
>        break;
>
> It can work, and all regression tests pass.  But I don't look into more details.  This solution may not fix the root cause.

Yes, that looks like the right fix.

This appears to be a trivial oversight in ExecInitPartitionInfo(). I
did a quick scan of other places that look at action->commandType and
I didn't see any others that overlook CMD_NOTHING.

Regards,
Dean





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-28 18:29   ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2025-03-29 02:39     ` Tender Wang <tndrwang@gmail.com>
  2025-03-29 05:54       ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Gurjeet Singh <gurjeet@singh.im>
  0 siblings, 1 reply; 7+ messages in thread

From: Tender Wang @ 2025-03-29 02:39 UTC (permalink / raw)
  To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

Dean Rasheed <dean.a.rasheed@gmail.com> 于2025年3月29日周六 02:29写道:

> On Fri, 28 Mar 2025 at 16:40, Tender Wang <tndrwang@gmail.com> wrote:
> >
> > I tried a quick fix by adding "case CMD_NOTHING" after "case CMD_DELETE"
> like below:
> >
> > case CMD_DELETE:
> > case CMD_NOTHING:
> >        break;
> >
> > It can work, and all regression tests pass.  But I don't look into more
> details.  This solution may not fix the root cause.
>
> Yes, that looks like the right fix.
>
> This appears to be a trivial oversight in ExecInitPartitionInfo(). I
> did a quick scan of other places that look at action->commandType and
> I didn't see any others that overlook CMD_NOTHING.
>

Yes, indeed. I double-check it.
In ExecInitPartitionInfo(), it has comments like:

* This duplicates much of the logic in ExecInitMerge(), so something
* changes there, look here too.

ExecInitMerge() considers CMD_NOTHING operation.
I give the attached fix.

-- 
Thanks,
Tender Wang
From 51ef883125694733302bd0a3e8e137f410d8c185 Mon Sep 17 00:00:00 2001
From: Tender Wang <tndrwang@gmail.com>
Date: Sat, 29 Mar 2025 10:28:52 +0800
Subject: [PATCH] Fix cross-partition merge fail.

---
 src/backend/executor/execPartition.c          |  1 +
 src/test/regress/expected/partition_prune.out | 28 +++++++++++++++++++
 src/test/regress/sql/partition_prune.sql      | 14 ++++++++++
 3 files changed, 43 insertions(+)

diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 84ccd7d457d..8d1e3c0624f 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -956,6 +956,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
 												  NULL);
 					break;
 				case CMD_DELETE:
+				case CMD_NOTHING:
 					break;
 
 				default:
diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out
index 0bf35260b46..2f3e5db8252 100644
--- a/src/test/regress/expected/partition_prune.out
+++ b/src/test/regress/expected/partition_prune.out
@@ -4694,6 +4694,34 @@ table part_abc_view;
  2 | c | t
 (2 rows)
 
+rollback;
+-- Cross-partition merge
+begin;
+explain (costs off)
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+              QUERY PLAN              
+--------------------------------------
+ Merge on part_abc
+   ->  Nested Loop Left Join
+         ->  Result
+         ->  Result
+               One-Time Filter: false
+(5 rows)
+
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+table part_abc_view;
+ a | b | c 
+---+---+---
+ 1 | 2 | 
+ 2 | c | t
+(2 rows)
+
 rollback;
 -- A case with multiple ModifyTable nodes.
 begin;
diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql
index f6db9479f54..339c8d9a4e8 100644
--- a/src/test/regress/sql/partition_prune.sql
+++ b/src/test/regress/sql/partition_prune.sql
@@ -1413,6 +1413,20 @@ when not matched then insert values (1, 'd', false) returning pt.a;
 table part_abc_view;
 rollback;
 
+-- Cross-partition merge
+begin;
+explain (costs off)
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+table part_abc_view;
+rollback;
+
 -- A case with multiple ModifyTable nodes.
 begin;
 create table part_abc_log (action text, a int, b text, c bool);
-- 
2.34.1



Attachments:

0001-Fix-cross-partition-merge-fail.patch (text/plain, 2.7K) download From 51ef883125694733302bd0a3e8e137f410d8c185 Mon Sep 17 00:00:00 2001 From: Tender Wang <tndrwang@gmail.com> Date: Sat, 29 Mar 2025 10:28:52 +0800 Subject: [PATCH] Fix cross-partition merge fail. --- src/backend/executor/execPartition.c | 1 + src/test/regress/expected/partition_prune.out | 28 +++++++++++++++++++ src/test/regress/sql/partition_prune.sql | 14 ++++++++++ 3 files changed, 43 insertions(+) diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 84ccd7d457d..8d1e3c0624f 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -956,6 +956,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate, NULL); break; case CMD_DELETE: + case CMD_NOTHING: break; default: diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out index 0bf35260b46..2f3e5db8252 100644 --- a/src/test/regress/expected/partition_prune.out +++ b/src/test/regress/expected/partition_prune.out @@ -4694,6 +4694,34 @@ table part_abc_view; 2 | c | t (2 rows) +rollback; +-- Cross-partition merge +begin; +explain (costs off) +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; + QUERY PLAN +-------------------------------------- + Merge on part_abc + -> Nested Loop Left Join + -> Result + -> Result + One-Time Filter: false +(5 rows) + +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +table part_abc_view; + a | b | c +---+---+--- + 1 | 2 | + 2 | c | t +(2 rows) + rollback; -- A case with multiple ModifyTable nodes. begin; diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql index f6db9479f54..339c8d9a4e8 100644 --- a/src/test/regress/sql/partition_prune.sql +++ b/src/test/regress/sql/partition_prune.sql @@ -1413,6 +1413,20 @@ when not matched then insert values (1, 'd', false) returning pt.a; table part_abc_view; rollback; +-- Cross-partition merge +begin; +explain (costs off) +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +table part_abc_view; +rollback; + -- A case with multiple ModifyTable nodes. begin; create table part_abc_log (action text, a int, b text, c bool); -- 2.34.1
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-28 18:29   ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
  2025-03-29 02:39     ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
@ 2025-03-29 05:54       ` Gurjeet Singh <gurjeet@singh.im>
  2025-03-29 10:20         ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Gurjeet Singh @ 2025-03-29 05:54 UTC (permalink / raw)
  To: Tender Wang <tndrwang@gmail.com>; Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

On Fri Mar 28, 2025 at 7:39 PM PDT, Tender Wang wrote:

> In ExecInitPartitionInfo(), it has comments like:
>
> * This duplicates much of the logic in ExecInitMerge(), so something
> * changes there, look here too.
>
> ExecInitMerge() considers CMD_NOTHING operation.
> I give the attached fix.

I would've expecetd the comment to be in ExecInitMerge(), asking the
reader to look at other places the logic is duplicated.

Attached is a patch with an attempt at that; it includes the diff from
your patch, too, so I named it v2.

Best regards,
Gurjeet
http://Gurje.et
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c
index 84ccd7d457d..8d1e3c0624f 100644
--- a/src/backend/executor/execPartition.c
+++ b/src/backend/executor/execPartition.c
@@ -956,6 +956,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
 												  NULL);
 					break;
 				case CMD_DELETE:
+				case CMD_NOTHING:
 					break;
 
 				default:
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 87c820276a8..381847cfdf3 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -3712,6 +3712,10 @@ ExecInitMerge(ModifyTableState *mtstate, EState *estate)
 				lappend(resultRelInfo->ri_MergeActions[action->matchKind],
 						action_state);
 
+			/*
+			 * ExecInitPartitionInfo() duplicates much of the logic here, so if
+			 * you change something here, look there, too.
+			 */
 			switch (action->commandType)
 			{
 				case CMD_INSERT:
diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out
index 0bf35260b46..2f3e5db8252 100644
--- a/src/test/regress/expected/partition_prune.out
+++ b/src/test/regress/expected/partition_prune.out
@@ -4694,6 +4694,34 @@ table part_abc_view;
  2 | c | t
 (2 rows)
 
+rollback;
+-- Cross-partition merge
+begin;
+explain (costs off)
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+              QUERY PLAN              
+--------------------------------------
+ Merge on part_abc
+   ->  Nested Loop Left Join
+         ->  Result
+         ->  Result
+               One-Time Filter: false
+(5 rows)
+
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+table part_abc_view;
+ a | b | c 
+---+---+---
+ 1 | 2 | 
+ 2 | c | t
+(2 rows)
+
 rollback;
 -- A case with multiple ModifyTable nodes.
 begin;
diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql
index f6db9479f54..339c8d9a4e8 100644
--- a/src/test/regress/sql/partition_prune.sql
+++ b/src/test/regress/sql/partition_prune.sql
@@ -1413,6 +1413,20 @@ when not matched then insert values (1, 'd', false) returning pt.a;
 table part_abc_view;
 rollback;
 
+-- Cross-partition merge
+begin;
+explain (costs off)
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+merge into part_abc_view pt
+using (select 3 as a) as q on pt.a = q.a
+WHEN NOT MATCHED THEN INSERT VALUES (1, 2)
+WHEN MATCHED THEN DO NOTHING;
+table part_abc_view;
+rollback;
+
 -- A case with multiple ModifyTable nodes.
 begin;
 create table part_abc_log (action text, a int, b text, c bool);


Attachments:

0002-Fix-cross-partition-merge-fail.patch (text/plain, 2.8K) download diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 84ccd7d457d..8d1e3c0624f 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -956,6 +956,7 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate, NULL); break; case CMD_DELETE: + case CMD_NOTHING: break; default: diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 87c820276a8..381847cfdf3 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -3712,6 +3712,10 @@ ExecInitMerge(ModifyTableState *mtstate, EState *estate) lappend(resultRelInfo->ri_MergeActions[action->matchKind], action_state); + /* + * ExecInitPartitionInfo() duplicates much of the logic here, so if + * you change something here, look there, too. + */ switch (action->commandType) { case CMD_INSERT: diff --git a/src/test/regress/expected/partition_prune.out b/src/test/regress/expected/partition_prune.out index 0bf35260b46..2f3e5db8252 100644 --- a/src/test/regress/expected/partition_prune.out +++ b/src/test/regress/expected/partition_prune.out @@ -4694,6 +4694,34 @@ table part_abc_view; 2 | c | t (2 rows) +rollback; +-- Cross-partition merge +begin; +explain (costs off) +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; + QUERY PLAN +-------------------------------------- + Merge on part_abc + -> Nested Loop Left Join + -> Result + -> Result + One-Time Filter: false +(5 rows) + +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +table part_abc_view; + a | b | c +---+---+--- + 1 | 2 | + 2 | c | t +(2 rows) + rollback; -- A case with multiple ModifyTable nodes. begin; diff --git a/src/test/regress/sql/partition_prune.sql b/src/test/regress/sql/partition_prune.sql index f6db9479f54..339c8d9a4e8 100644 --- a/src/test/regress/sql/partition_prune.sql +++ b/src/test/regress/sql/partition_prune.sql @@ -1413,6 +1413,20 @@ when not matched then insert values (1, 'd', false) returning pt.a; table part_abc_view; rollback; +-- Cross-partition merge +begin; +explain (costs off) +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +merge into part_abc_view pt +using (select 3 as a) as q on pt.a = q.a +WHEN NOT MATCHED THEN INSERT VALUES (1, 2) +WHEN MATCHED THEN DO NOTHING; +table part_abc_view; +rollback; + -- A case with multiple ModifyTable nodes. begin; create table part_abc_log (action text, a int, b text, c bool);
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-28 18:29   ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
  2025-03-29 02:39     ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-29 05:54       ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Gurjeet Singh <gurjeet@singh.im>
@ 2025-03-29 10:20         ` Dean Rasheed <dean.a.rasheed@gmail.com>
  2025-03-29 10:40           ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Dean Rasheed @ 2025-03-29 10:20 UTC (permalink / raw)
  To: Gurjeet Singh <gurjeet@singh.im>; +Cc: Tender Wang <tndrwang@gmail.com>; exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

On Sat, 29 Mar 2025 at 05:54, Gurjeet Singh <gurjeet@singh.im> wrote:
>
> On Fri Mar 28, 2025 at 7:39 PM PDT, Tender Wang wrote:
>
> > In ExecInitPartitionInfo(), it has comments like:
> >
> > * This duplicates much of the logic in ExecInitMerge(), so something
> > * changes there, look here too.
> >
> I would've expecetd the comment to be in ExecInitMerge(), asking the
> reader to look at other places the logic is duplicated.
>

There already is such a comment a little further up in
ExecInitMerge(), so I didn't bother repeating it.

I've committed the fix, except that I put the test case in merge.sql,
since part_abc_view doesn't exist in back branches of
partition_prune.sql, and it feels more like a MERGE bug anyway.

Thanks, all.

Regards,
Dean





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18871: Cross-partition MERGE fails with unclear internal error
  2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
  2025-03-28 16:39 ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-28 18:29   ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
  2025-03-29 02:39     ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Tender Wang <tndrwang@gmail.com>
  2025-03-29 05:54       ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Gurjeet Singh <gurjeet@singh.im>
  2025-03-29 10:20         ` Re: BUG #18871: Cross-partition MERGE fails with unclear internal error Dean Rasheed <dean.a.rasheed@gmail.com>
@ 2025-03-29 10:40           ` Tender Wang <tndrwang@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Tender Wang @ 2025-03-29 10:40 UTC (permalink / raw)
  To: Dean Rasheed <dean.a.rasheed@gmail.com>; +Cc: Gurjeet Singh <gurjeet@singh.im>; exclusion@gmail.com; pgsql-bugs@lists.postgresql.org

Dean Rasheed <dean.a.rasheed@gmail.com> 于2025年3月29日周六 18:20写道:

> On Sat, 29 Mar 2025 at 05:54, Gurjeet Singh <gurjeet@singh.im> wrote:
> >
> > On Fri Mar 28, 2025 at 7:39 PM PDT, Tender Wang wrote:
> >
> > > In ExecInitPartitionInfo(), it has comments like:
> > >
> > > * This duplicates much of the logic in ExecInitMerge(), so something
> > > * changes there, look here too.
> > >
> > I would've expecetd the comment to be in ExecInitMerge(), asking the
> > reader to look at other places the logic is duplicated.
> >
>
> There already is such a comment a little further up in
> ExecInitMerge(), so I didn't bother repeating it.
>
> I've committed the fix, except that I put the test case in merge.sql,
> since part_abc_view doesn't exist in back branches of
> partition_prune.sql, and it feels more like a MERGE bug anyway.
>

Agree.
Thanks for pushing.

-- 
Thanks,
Tender Wang

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2025-03-29 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-28 05:00 BUG #18871: Cross-partition MERGE fails with unclear internal error PG Bug reporting form <noreply@postgresql.org>
2025-03-28 16:39 ` Tender Wang <tndrwang@gmail.com>
2025-03-28 18:29   ` Dean Rasheed <dean.a.rasheed@gmail.com>
2025-03-29 02:39     ` Tender Wang <tndrwang@gmail.com>
2025-03-29 05:54       ` Gurjeet Singh <gurjeet@singh.im>
2025-03-29 10:20         ` Dean Rasheed <dean.a.rasheed@gmail.com>
2025-03-29 10:40           ` Tender Wang <tndrwang@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox