From 54fcf1bb15493c777e1adcef1073bf120fd9e46e Mon Sep 17 00:00:00 2001
From: houzj <houzj.fnst@cn.fujitsu.com>
Date: Wed, 9 Dec 2020 10:13:52 +0800
Subject: [PATCH] fix typo about generate_gather_paths

---
 src/backend/optimizer/path/allpaths.c |  2 +-
 src/backend/optimizer/plan/planner.c  | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 84a69b0..dd9865d 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -3158,7 +3158,7 @@ standard_join_search(PlannerInfo *root, int levels_needed, List *initial_rels)
 		join_search_one_level(root, lev);
 
 		/*
-		 * Run generate_partitionwise_join_paths() and generate_gather_paths()
+		 * Run generate_partitionwise_join_paths() and generate_useful_gather_paths()
 		 * for each just-processed joinrel.  We could not do this earlier
 		 * because both regular and partial paths can get added to a
 		 * particular joinrel at multiple times within join_search_one_level.
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 1a94b58..360d2a6 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -5049,13 +5049,13 @@ create_ordered_paths(PlannerInfo *root,
 	}
 
 	/*
-	 * generate_gather_paths() will have already generated a simple Gather
-	 * path for the best parallel path, if any, and the loop above will have
-	 * considered sorting it.  Similarly, generate_gather_paths() will also
-	 * have generated order-preserving Gather Merge plans which can be used
-	 * without sorting if they happen to match the sort_pathkeys, and the loop
-	 * above will have handled those as well.  However, there's one more
-	 * possibility: it may make sense to sort the cheapest partial path
+	 * generate_useful_gather_paths() will have already generated a simple
+	 * Gather path for the best parallel path, if any, and the loop above will
+	 * have considered sorting it.  Similarly, generate_useful_gather_paths()
+	 * will also have generated order-preserving Gather Merge plans which can
+	 * be used without sorting if they happen to match the sort_pathkeys, and
+	 * the loop above will have handled those as well.  However, there's one
+	 * more possibility: it may make sense to sort the cheapest partial path
 	 * according to the required output order and then use Gather Merge.
 	 */
 	if (ordered_rel->consider_parallel && root->sort_pathkeys != NIL &&
@@ -7213,14 +7213,14 @@ create_partial_grouping_paths(PlannerInfo *root,
  * Generate Gather and Gather Merge paths for a grouping relation or partial
  * grouping relation.
  *
- * generate_gather_paths does most of the work, but we also consider a special
- * case: we could try sorting the data by the group_pathkeys and then applying
- * Gather Merge.
+ * generate_useful_gather_paths does most of the work, but we also consider a
+ * special case: we could try sorting the data by the group_pathkeys and then
+ * applying Gather Merge.
  *
  * NB: This function shouldn't be used for anything other than a grouped or
  * partially grouped relation not only because of the fact that it explicitly
  * references group_pathkeys but we pass "true" as the third argument to
- * generate_gather_paths().
+ * generate_useful_gather_paths().
  */
 static void
 gather_grouping_paths(PlannerInfo *root, RelOptInfo *rel)
@@ -7380,10 +7380,10 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
 	 * variations.  So we drop old paths and thereby force the work to be done
 	 * below the Append, except in the case of a non-parallel-safe target.
 	 *
-	 * Some care is needed, because we have to allow generate_gather_paths to
-	 * see the old partial paths in the next stanza.  Hence, zap the main
-	 * pathlist here, then allow generate_gather_paths to add path(s) to the
-	 * main list, and finally zap the partial pathlist.
+	 * Some care is needed, because we have to allow generate_useful_gather_paths
+	 * to see the old partial paths in the next stanza.  Hence, zap the main
+	 * pathlist here, then allow generate_useful_gather_paths to add path(s)
+	 * to the main list, and finally zap the partial pathlist.
 	 */
 	if (rel_is_partitioned)
 		rel->pathlist = NIL;
-- 
2.7.2.windows.1

