diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 8937e71..5f2ddae 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -1682,7 +1682,8 @@ grouping_planner(PlannerInfo *root, bool inheritance_update, scanjoin_target = grouping_target; /* - * Forcibly apply that target to all the Paths for the scan/join rel. + * Forcibly apply that target to all the Paths and Partial Paths for + * the scan/join rel. * * In principle we should re-run set_cheapest() here to identify the * cheapest path, but it seems unlikely that adding the same tlist @@ -1710,6 +1711,19 @@ grouping_planner(PlannerInfo *root, bool inheritance_update, } } + foreach(lc, current_rel->partial_pathlist) + { + Path *subpath = (Path *) lfirst(lc); + Path *path; + + Assert(subpath->param_info == NULL); + path = apply_projection_to_path(root, current_rel, + subpath, scanjoin_target); + /* If we had to add a Result, path is different from subpath */ + if (path != subpath) + lfirst(lc) = path; + } + /* * If we have grouping and/or aggregation, consider ways to implement * that. We build a new upperrel representing the output of this