diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index 7607501fe7..8d781c75a8 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -1020,9 +1020,6 @@ partition_bounds_merge(int partnatts,
 					   JoinType jointype,
 					   List **outer_parts, List **inner_parts)
 {
-	PartitionBoundInfo outer_binfo = outer_rel->boundinfo;
-	PartitionBoundInfo inner_binfo = inner_rel->boundinfo;
-
 	/*
 	 * Currently, this function is called only from try_partitionwise_join(),
 	 * so the join type should be INNER, LEFT, FULL, SEMI, or ANTI.
@@ -1031,11 +1028,8 @@ partition_bounds_merge(int partnatts,
 		   jointype == JOIN_FULL || jointype == JOIN_SEMI ||
 		   jointype == JOIN_ANTI);
 
-	/* The partitioning strategies should be the same. */
-	Assert(outer_binfo->strategy == inner_binfo->strategy);
-
 	*outer_parts = *inner_parts = NIL;
-	switch (outer_binfo->strategy)
+	switch (outer_rel->boundinfo->strategy)
 	{
 		case PARTITION_STRATEGY_HASH:
 
@@ -1076,7 +1070,7 @@ partition_bounds_merge(int partnatts,
 
 		default:
 			elog(ERROR, "unexpected partition strategy: %d",
-				 (int) outer_binfo->strategy);
+				 (int) outer_rel->boundinfo->strategy);
 			return NULL;				/* keep compiler quiet */
 	}
 }
