@@ -376,11 +376,11 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
376376 Assert (childrel -> rows > 0 );
377377
378378 parent_rows += childrel -> rows ;
379- parent_size += childrel -> width * childrel -> rows ;
379+ parent_size += childrel -> reltarget -> width * childrel -> rows ;
380380 }
381381
382382 rel -> rows = parent_rows ;
383- rel -> width = rint (parent_size / parent_rows );
383+ rel -> reltarget -> width = rint (parent_size / parent_rows );
384384 rel -> tuples = parent_rows ;
385385}
386386
@@ -423,15 +423,19 @@ append_child_relation(PlannerInfo *root, RelOptInfo *rel, Index rti,
423423 childrel = build_simple_rel (root , childRTindex , RELOPT_OTHER_MEMBER_REL );
424424
425425 /* Copy targetlist */
426- childrel -> reltargetlist = NIL ;
427- foreach (lc , rel -> reltargetlist )
426+ childrel -> reltarget -> exprs = NIL ;
427+ childrel -> reltarget -> sortgrouprefs = (Index * ) palloc (
428+ list_length (rel -> reltarget -> exprs ) * sizeof (Index ));
429+ foreach (lc , rel -> reltarget -> exprs )
428430 {
429431 Node * new_target ;
430432
431433 node = (Node * ) lfirst (lc );
432434 new_target = copyObject (node );
433435 change_varnos (new_target , rel -> relid , childrel -> relid );
434- childrel -> reltargetlist = lappend (childrel -> reltargetlist , new_target );
436+ childrel -> reltarget -> exprs = lappend (childrel -> reltarget -> exprs ,
437+ new_target );
438+ /* childrel->reltarget->sortgrouprefs[i++] = */
435439 }
436440
437441 /* Copy attr_needed & attr_widths */
@@ -1640,7 +1644,7 @@ set_plain_rel_size(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
16401644 * Test any partial indexes of rel for applicability. We must do this
16411645 * first since partial unique indexes can affect size estimates.
16421646 */
1643- check_partial_indexes (root , rel );
1647+ check_index_predicates (root , rel );
16441648
16451649 /* Mark rel with estimated output rows, width, etc */
16461650 set_baserel_size_estimates (root , rel );
@@ -1854,7 +1858,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
18541858 * if we have zero or one live subpath due to constraint exclusion.)
18551859 */
18561860 if (subpaths_valid )
1857- add_path (rel , (Path * ) create_append_path (rel , subpaths , NULL ));
1861+ add_path (rel , (Path * ) create_append_path (rel , subpaths , NULL , 0 ));
18581862
18591863 /*
18601864 * Also build unparameterized MergeAppend paths based on the collected
@@ -1905,7 +1909,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
19051909
19061910 if (subpaths_valid )
19071911 add_path (rel , (Path * )
1908- create_append_path (rel , subpaths , required_outer ));
1912+ create_append_path (rel , subpaths , required_outer , 0 ));
19091913 }
19101914}
19111915
@@ -2083,13 +2087,13 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
20832087 {
20842088 Path * path ;
20852089
2086- path = (Path * ) create_append_path (rel , startup_subpaths , NULL );
2090+ path = (Path * ) create_append_path (rel , startup_subpaths , NULL , 0 );
20872091 path -> pathkeys = pathkeys ;
20882092 add_path (rel , path );
20892093
20902094 if (startup_neq_total )
20912095 {
2092- path = (Path * ) create_append_path (rel , total_subpaths , NULL );
2096+ path = (Path * ) create_append_path (rel , total_subpaths , NULL , 0 );
20932097 path -> pathkeys = pathkeys ;
20942098 add_path (rel , path );
20952099 }
@@ -2103,14 +2107,14 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
21032107 Path * path ;
21042108
21052109 path = (Path * ) create_append_path (rel ,
2106- list_reverse (startup_subpaths ), NULL );
2110+ list_reverse (startup_subpaths ), NULL , 0 );
21072111 path -> pathkeys = pathkeys ;
21082112 add_path (rel , path );
21092113
21102114 if (startup_neq_total )
21112115 {
21122116 path = (Path * ) create_append_path (rel ,
2113- list_reverse (total_subpaths ), NULL );
2117+ list_reverse (total_subpaths ), NULL , 0 );
21142118 path -> pathkeys = pathkeys ;
21152119 add_path (rel , path );
21162120 }
0 commit comments