@ -1543,7 +1543,6 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
SpecialJoinInfo * child_sjinfo ;
SpecialJoinInfo * child_sjinfo ;
List * child_restrictlist ;
List * child_restrictlist ;
RelOptInfo * child_joinrel ;
RelOptInfo * child_joinrel ;
Relids child_joinrelids ;
AppendRelInfo * * appinfos ;
AppendRelInfo * * appinfos ;
int nappinfos ;
int nappinfos ;
@ -1646,10 +1645,6 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
child_rel2 - > relids ) ,
child_rel2 - > relids ) ,
& nappinfos ) ;
& nappinfos ) ;
/* Build correct join relids for child join */
child_joinrelids = adjust_child_relids ( joinrel - > relids ,
nappinfos , appinfos ) ;
/*
/*
* Construct restrictions applicable to the child join from those
* Construct restrictions applicable to the child join from those
* applicable to the parent join .
* applicable to the parent join .
@ -1658,8 +1653,8 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
( List * ) adjust_appendrel_attrs ( root ,
( List * ) adjust_appendrel_attrs ( root ,
( Node * ) parent_restrictlist ,
( Node * ) parent_restrictlist ,
nappinfos , appinfos ) ;
nappinfos , appinfos ) ;
pfree ( appinfos ) ;
/* Find or construct the child join's RelOptInfo */
child_joinrel = joinrel - > part_rels [ cnt_parts ] ;
child_joinrel = joinrel - > part_rels [ cnt_parts ] ;
if ( ! child_joinrel )
if ( ! child_joinrel )
{
{
@ -1672,11 +1667,17 @@ try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
child_joinrel - > relids ) ;
child_joinrel - > relids ) ;
}
}
Assert ( bms_equal ( child_joinrel - > relids , child_joinrelids ) ) ;
/* Assert we got the right one */
Assert ( bms_equal ( child_joinrel - > relids ,
adjust_child_relids ( joinrel - > relids ,
nappinfos , appinfos ) ) ) ;
/* And make paths for the child join */
populate_joinrel_with_paths ( root , child_rel1 , child_rel2 ,
populate_joinrel_with_paths ( root , child_rel1 , child_rel2 ,
child_joinrel , child_sjinfo ,
child_joinrel , child_sjinfo ,
child_restrictlist ) ;
child_restrictlist ) ;
pfree ( appinfos ) ;
}
}
}
}