em_is_child_em_relids.patch

text/x-patch

Filename: em_is_child_em_relids.patch
Type: text/x-patch
Part: 0
Message: Re: Partition-wise join for join between (declaratively) partitioned tables

Patch

Format: unified
File+
src/backend/optimizer/plan/createplan.c 3 0
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 2821662..78eec0a 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -5680,6 +5680,7 @@ prepare_sort_from_pathkeys(Plan *lefttree, List *pathkeys,
 				if (em->em_is_const)
 					continue;
 
+				Assert(!em->em_is_child || !bms_is_empty(em->em_relids));
 				/*
 				 * Ignore child members unless they match the rel being
 				 * sorted.
@@ -5796,6 +5797,8 @@ find_ec_member_for_tle(EquivalenceClass *ec,
 		if (em->em_is_const)
 			continue;
 
+		Assert(!em->em_is_child || !bms_is_empty(em->em_relids));
+
 		/*
 		 * Ignore child members unless they match the rel being sorted.
 		 */