@@ -1248,17 +1248,17 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
1248
1248
need_sort_for_grouping = true;
1249
1249
1250
1250
/*
1251
- * Always override query_planner 's tlist, so that we don't
1251
+ * Always override create_plan 's tlist, so that we don't
1252
1252
* sort useless data from a "physical" tlist.
1253
1253
*/
1254
1254
need_tlist_eval = true;
1255
1255
}
1256
1256
1257
1257
/*
1258
- * create_plan() returns a plan with just a "flat" tlist of
1258
+ * create_plan returns a plan with just a "flat" tlist of
1259
1259
* required Vars. Usually we need to insert the sub_tlist as the
1260
1260
* tlist of the top plan node. However, we can skip that if we
1261
- * determined that whatever query_planner chose to return will be
1261
+ * determined that whatever create_plan chose to return will be
1262
1262
* good enough.
1263
1263
*/
1264
1264
if (need_tlist_eval )
@@ -1311,7 +1311,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
1311
1311
else
1312
1312
{
1313
1313
/*
1314
- * Since we're using query_planner 's tlist and not the one
1314
+ * Since we're using create_plan 's tlist and not the one
1315
1315
* make_subplanTargetList calculated, we have to refigure any
1316
1316
* grouping-column indexes make_subplanTargetList computed.
1317
1317
*/
@@ -2521,10 +2521,11 @@ choose_hashed_distinct(PlannerInfo *root,
2521
2521
* make_subplanTargetList
2522
2522
* Generate appropriate target list when grouping is required.
2523
2523
*
2524
- * When grouping_planner inserts Aggregate, Group, or Result plan nodes
2525
- * above the result of query_planner, we typically want to pass a different
2526
- * target list to query_planner than the outer plan nodes should have.
2527
- * This routine generates the correct target list for the subplan.
2524
+ * When grouping_planner inserts grouping or aggregation plan nodes
2525
+ * above the scan/join plan constructed by query_planner+create_plan,
2526
+ * we typically want the scan/join plan to emit a different target list
2527
+ * than the outer plan nodes should have. This routine generates the
2528
+ * correct target list for the scan/join subplan.
2528
2529
*
2529
2530
* The initial target list passed from the parser already contains entries
2530
2531
* for all ORDER BY and GROUP BY expressions, but it will not have entries
@@ -2547,15 +2548,18 @@ choose_hashed_distinct(PlannerInfo *root,
2547
2548
* If we are grouping or aggregating, *and* there are no non-Var grouping
2548
2549
* expressions, then the returned tlist is effectively dummy; we do not
2549
2550
* need to force it to be evaluated, because all the Vars it contains
2550
- * should be present in the output of query_planner anyway.
2551
+ * should be present in the "flat" tlist generated by create_plan, though
2552
+ * possibly in a different order. In that case we'll use create_plan's tlist,
2553
+ * and the tlist made here is only needed as input to query_planner to tell
2554
+ * it which Vars are needed in the output of the scan/join plan.
2551
2555
*
2552
2556
* 'tlist' is the query's target list.
2553
2557
* 'groupColIdx' receives an array of column numbers for the GROUP BY
2554
- * expressions (if there are any) in the subplan's target list.
2558
+ * expressions (if there are any) in the returned target list.
2555
2559
* 'need_tlist_eval' is set true if we really need to evaluate the
2556
- * result tlist.
2560
+ * returned tlist as-is .
2557
2561
*
2558
- * The result is the targetlist to be passed to the subplan .
2562
+ * The result is the targetlist to be passed to query_planner .
2559
2563
*/
2560
2564
static List *
2561
2565
make_subplanTargetList (PlannerInfo * root ,
@@ -2649,7 +2653,7 @@ make_subplanTargetList(PlannerInfo *root,
2649
2653
2650
2654
/*
2651
2655
* locate_grouping_columns
2652
- * Locate grouping columns in the tlist chosen by query_planner .
2656
+ * Locate grouping columns in the tlist chosen by create_plan .
2653
2657
*
2654
2658
* This is only needed if we don't use the sub_tlist chosen by
2655
2659
* make_subplanTargetList. We have to forget the column indexes found
0 commit comments