@@ -91,45 +91,65 @@ typedef struct PlannerGlobal
9191{
9292 NodeTag type ;
9393
94- ParamListInfo boundParams ; /* Param values provided to planner() */
94+ /* Param values provided to planner() */
95+ ParamListInfo boundParams ;
9596
96- List * subplans ; /* Plans for SubPlan nodes */
97+ /* Plans for SubPlan nodes */
98+ List * subplans ;
9799
98- List * subroots ; /* PlannerInfos for SubPlan nodes */
100+ /* PlannerInfos for SubPlan nodes */
101+ List * subroots ;
99102
100- Bitmapset * rewindPlanIDs ; /* indices of subplans that require REWIND */
103+ /* indices of subplans that require REWIND */
104+ Bitmapset * rewindPlanIDs ;
101105
102- List * finalrtable ; /* "flat" rangetable for executor */
106+ /* "flat" rangetable for executor */
107+ List * finalrtable ;
103108
104- List * finalrowmarks ; /* "flat" list of PlanRowMarks */
109+ /* "flat" list of PlanRowMarks */
110+ List * finalrowmarks ;
105111
106- List * resultRelations ; /* "flat" list of integer RT indexes */
112+ /* "flat" list of integer RT indexes */
113+ List * resultRelations ;
107114
108- List * appendRelations ; /* "flat" list of AppendRelInfos */
115+ /* "flat" list of AppendRelInfos */
116+ List * appendRelations ;
109117
110- List * relationOids ; /* OIDs of relations the plan depends on */
118+ /* OIDs of relations the plan depends on */
119+ List * relationOids ;
111120
112- List * invalItems ; /* other dependencies, as PlanInvalItems */
121+ /* other dependencies, as PlanInvalItems */
122+ List * invalItems ;
113123
114- List * paramExecTypes ; /* type OIDs for PARAM_EXEC Params */
124+ /* type OIDs for PARAM_EXEC Params */
125+ List * paramExecTypes ;
115126
116- Index lastPHId ; /* highest PlaceHolderVar ID assigned */
127+ /* highest PlaceHolderVar ID assigned */
128+ Index lastPHId ;
117129
118- Index lastRowMarkId ; /* highest PlanRowMark ID assigned */
130+ /* highest PlanRowMark ID assigned */
131+ Index lastRowMarkId ;
119132
120- int lastPlanNodeId ; /* highest plan node ID assigned */
133+ /* highest plan node ID assigned */
134+ int lastPlanNodeId ;
121135
122- bool transientPlan ; /* redo plan when TransactionXmin changes? */
136+ /* redo plan when TransactionXmin changes? */
137+ bool transientPlan ;
123138
124- bool dependsOnRole ; /* is plan specific to current role? */
139+ /* is plan specific to current role? */
140+ bool dependsOnRole ;
125141
126- bool parallelModeOK ; /* parallel mode potentially OK? */
142+ /* parallel mode potentially OK? */
143+ bool parallelModeOK ;
127144
128- bool parallelModeNeeded ; /* parallel mode actually required? */
145+ /* parallel mode actually required? */
146+ bool parallelModeNeeded ;
129147
130- char maxParallelHazard ; /* worst PROPARALLEL hazard level */
148+ /* worst PROPARALLEL hazard level */
149+ char maxParallelHazard ;
131150
132- PartitionDirectory partition_directory ; /* partition descriptors */
151+ /* partition descriptors */
152+ PartitionDirectory partition_directory ;
133153} PlannerGlobal ;
134154
135155/* macro for fetching the Plan associated with a SubPlan node */
@@ -159,21 +179,26 @@ struct PlannerInfo
159179{
160180 NodeTag type ;
161181
162- Query * parse ; /* the Query being planned */
182+ /* the Query being planned */
183+ Query * parse ;
163184
164- PlannerGlobal * glob ; /* global info for current planner run */
185+ /* global info for current planner run */
186+ PlannerGlobal * glob ;
165187
166- Index query_level ; /* 1 at the outermost Query */
188+ /* 1 at the outermost Query */
189+ Index query_level ;
167190
168- PlannerInfo * parent_root ; /* NULL at outermost Query */
191+ /* NULL at outermost Query */
192+ PlannerInfo * parent_root ;
169193
170194 /*
171195 * plan_params contains the expressions that this query level needs to
172196 * make available to a lower query level that is currently being planned.
173197 * outer_params contains the paramIds of PARAM_EXEC Params that outer
174198 * query levels will make available to this query level.
175199 */
176- List * plan_params ; /* list of PlannerParamItems, see below */
200+ /* list of PlannerParamItems, see below */
201+ List * plan_params ;
177202 Bitmapset * outer_params ;
178203
179204 /*
@@ -183,15 +208,16 @@ struct PlannerInfo
183208 * does not correspond to a base relation, such as a join RTE or an
184209 * unreferenced view RTE; or if the RelOptInfo hasn't been made yet.
185210 */
186- struct RelOptInfo * * simple_rel_array ; /* All 1-rel RelOptInfos */
187- int simple_rel_array_size ; /* allocated size of array */
211+ struct RelOptInfo * * simple_rel_array ;
212+ /* allocated size of array */
213+ int simple_rel_array_size ;
188214
189215 /*
190216 * simple_rte_array is the same length as simple_rel_array and holds
191217 * pointers to the associated rangetable entries. Using this is a shade
192218 * faster than using rt_fetch(), mostly due to fewer indirections.
193219 */
194- RangeTblEntry * * simple_rte_array ; /* rangetable as an array */
220+ RangeTblEntry * * simple_rte_array ;
195221
196222 /*
197223 * append_rel_array is the same length as the above arrays, and holds
@@ -236,35 +262,51 @@ struct PlannerInfo
236262 * automatically added to the join_rel_level[join_cur_level] list.
237263 * join_rel_level is NULL if not in use.
238264 */
239- List * * join_rel_level ; /* lists of join-relation RelOptInfos */
240- int join_cur_level ; /* index of list being extended */
265+ /* lists of join-relation RelOptInfos */
266+ List * * join_rel_level ;
267+ /* index of list being extended */
268+ int join_cur_level ;
241269
242- List * init_plans ; /* init SubPlans for query */
270+ /* init SubPlans for query */
271+ List * init_plans ;
243272
244- List * cte_plan_ids ; /* per-CTE-item list of subplan IDs (or -1 if
245- * no subplan was made for that CTE) */
273+ /*
274+ * per-CTE-item list of subplan IDs (or -1 if no subplan was made for that
275+ * CTE)
276+ */
277+ List * cte_plan_ids ;
246278
247- List * multiexpr_params ; /* List of Lists of Params for MULTIEXPR
248- * subquery outputs */
279+ /* List of Lists of Params for MULTIEXPR subquery outputs */
280+ List * multiexpr_params ;
249281
250- List * eq_classes ; /* list of active EquivalenceClasses */
282+ /* list of active EquivalenceClasses */
283+ List * eq_classes ;
251284
252- bool ec_merging_done ; /* set true once ECs are canonical */
285+ /* set true once ECs are canonical */
286+ bool ec_merging_done ;
253287
254- List * canon_pathkeys ; /* list of "canonical" PathKeys */
288+ /* list of "canonical" PathKeys */
289+ List * canon_pathkeys ;
255290
256- List * left_join_clauses ; /* list of RestrictInfos for mergejoinable
257- * outer join clauses w/nonnullable var on
258- * left */
291+ /*
292+ * list of RestrictInfos for mergejoinable outer join clauses
293+ * w/nonnullable var on left
294+ */
295+ List * left_join_clauses ;
259296
260- List * right_join_clauses ; /* list of RestrictInfos for mergejoinable
261- * outer join clauses w/nonnullable var on
262- * right */
297+ /*
298+ * list of RestrictInfos for mergejoinable outer join clauses
299+ * w/nonnullable var on right
300+ */
301+ List * right_join_clauses ;
263302
264- List * full_join_clauses ; /* list of RestrictInfos for mergejoinable
265- * full join clauses */
303+ /*
304+ * list of RestrictInfos for mergejoinable full join clauses
305+ */
306+ List * full_join_clauses ;
266307
267- List * join_info_list ; /* list of SpecialJoinInfos */
308+ /* list of SpecialJoinInfos */
309+ List * join_info_list ;
268310
269311 /*
270312 * all_result_relids is empty for SELECT, otherwise it contains at least
@@ -274,38 +316,55 @@ struct PlannerInfo
274316 * leaf_result_relids is similar except that only actual result tables,
275317 * not partitioned tables, are included in it.
276318 */
277- Relids all_result_relids ; /* set of all result relids */
278- Relids leaf_result_relids ; /* set of all leaf relids */
319+ /* set of all result relids */
320+ Relids all_result_relids ;
321+ /* set of all leaf relids */
322+ Relids leaf_result_relids ;
279323
280324 /*
325+ * list of AppendRelInfos
326+ *
281327 * Note: for AppendRelInfos describing partitions of a partitioned table,
282328 * we guarantee that partitions that come earlier in the partitioned
283329 * table's PartitionDesc will appear earlier in append_rel_list.
284330 */
285- List * append_rel_list ; /* list of AppendRelInfos */
331+ List * append_rel_list ;
286332
287- List * row_identity_vars ; /* list of RowIdentityVarInfos */
333+ /* list of RowIdentityVarInfos */
334+ List * row_identity_vars ;
288335
289- List * rowMarks ; /* list of PlanRowMarks */
336+ /* list of PlanRowMarks */
337+ List * rowMarks ;
290338
291- List * placeholder_list ; /* list of PlaceHolderInfos */
339+ /* list of PlaceHolderInfos */
340+ List * placeholder_list ;
292341
293- List * fkey_list ; /* list of ForeignKeyOptInfos */
342+ /* list of ForeignKeyOptInfos */
343+ List * fkey_list ;
294344
295- List * query_pathkeys ; /* desired pathkeys for query_planner() */
345+ /* desired pathkeys for query_planner() */
346+ List * query_pathkeys ;
296347
297- List * group_pathkeys ; /* groupClause pathkeys, if any */
298- List * window_pathkeys ; /* pathkeys of bottom window, if any */
299- List * distinct_pathkeys ; /* distinctClause pathkeys, if any */
300- List * sort_pathkeys ; /* sortClause pathkeys, if any */
348+ /* groupClause pathkeys, if any */
349+ List * group_pathkeys ;
350+ /* pathkeys of bottom window, if any */
351+ List * window_pathkeys ;
352+ /* distinctClause pathkeys, if any */
353+ List * distinct_pathkeys ;
354+ /* sortClause pathkeys, if any */
355+ List * sort_pathkeys ;
301356
302- List * part_schemes ; /* Canonicalised partition schemes used in the
303- * query. */
357+ /* Canonicalised partition schemes used in the query. */
358+ List * part_schemes ;
304359
305- List * initial_rels ; /* RelOptInfos we are now trying to join */
360+ /* RelOptInfos we are now trying to join */
361+ List * initial_rels ;
306362
307- /* Use fetch_upper_rel() to get any particular upper rel */
308- List * upper_rels [UPPERREL_FINAL + 1 ]; /* upper-rel RelOptInfos */
363+ /*
364+ * Upper-rel RelOptInfos. Use fetch_upper_rel() to get any particular
365+ * upper rel.
366+ */
367+ List * upper_rels [UPPERREL_FINAL + 1 ];
309368
310369 /* Result tlists chosen by grouping_planner for upper-stage processing */
311370 struct PathTarget * upper_targets [UPPERREL_FINAL + 1 ];
@@ -340,39 +399,62 @@ struct PlannerInfo
340399 /* context holding PlannerInfo */
341400 MemoryContext planner_cxt ;
342401
343- Cardinality total_table_pages ; /* # of pages in all non-dummy tables of
344- * query */
345-
346- Selectivity tuple_fraction ; /* tuple_fraction passed to query_planner */
347- Cardinality limit_tuples ; /* limit_tuples passed to query_planner */
402+ /* # of pages in all non-dummy tables of query */
403+ Cardinality total_table_pages ;
348404
349- Index qual_security_level ; /* minimum security_level for quals */
350- /* Note: qual_security_level is zero if there are no securityQuals */
405+ /* tuple_fraction passed to query_planner */
406+ Selectivity tuple_fraction ;
407+ /* limit_tuples passed to query_planner */
408+ Cardinality limit_tuples ;
351409
352- bool hasJoinRTEs ; /* true if any RTEs are RTE_JOIN kind */
353- bool hasLateralRTEs ; /* true if any RTEs are marked LATERAL */
354- bool hasHavingQual ; /* true if havingQual was non-null */
355- bool hasPseudoConstantQuals ; /* true if any RestrictInfo has
356- * pseudoconstant = true */
357- bool hasAlternativeSubPlans ; /* true if we've made any of those */
358- bool hasRecursion ; /* true if planning a recursive WITH item */
410+ /*
411+ * Minimum security_level for quals. Note: qual_security_level is zero if
412+ * there are no securityQuals.
413+ */
414+ Index qual_security_level ;
415+
416+ /* true if any RTEs are RTE_JOIN kind */
417+ bool hasJoinRTEs ;
418+ /* true if any RTEs are marked LATERAL */
419+ bool hasLateralRTEs ;
420+ /* true if havingQual was non-null */
421+ bool hasHavingQual ;
422+ /* true if any RestrictInfo has pseudoconstant = true */
423+ bool hasPseudoConstantQuals ;
424+ /* true if we've made any of those */
425+ bool hasAlternativeSubPlans ;
426+ /* true if planning a recursive WITH item */
427+ bool hasRecursion ;
359428
360429 /*
361430 * Information about aggregates. Filled by preprocess_aggrefs().
362431 */
363- List * agginfos ; /* AggInfo structs */
364- List * aggtransinfos ; /* AggTransInfo structs */
365- int numOrderedAggs ; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
366- bool hasNonPartialAggs ; /* does any agg not support partial mode? */
367- bool hasNonSerialAggs ; /* is any partial agg non-serializable? */
432+ /* AggInfo structs */
433+ List * agginfos ;
434+ /* AggTransInfo structs */
435+ List * aggtransinfos ;
436+ /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
437+ int numOrderedAggs ;
438+ /* does any agg not support partial mode? */
439+ bool hasNonPartialAggs ;
440+ /* is any partial agg non-serializable? */
441+ bool hasNonSerialAggs ;
368442
369- /* These fields are used only when hasRecursion is true: */
370- int wt_param_id ; /* PARAM_EXEC ID for the work table */
371- struct Path * non_recursive_path ; /* a path for non-recursive term */
443+ /*
444+ * These fields are used only when hasRecursion is true:
445+ */
446+ /* PARAM_EXEC ID for the work table */
447+ int wt_param_id ;
448+ /* a path for non-recursive term */
449+ struct Path * non_recursive_path ;
372450
373- /* These fields are workspace for createplan.c */
374- Relids curOuterRels ; /* outer rels above current node */
375- List * curOuterParams ; /* not-yet-assigned NestLoopParams */
451+ /*
452+ * These fields are workspace for createplan.c
453+ */
454+ /* outer rels above current node */
455+ Relids curOuterRels ;
456+ /* not-yet-assigned NestLoopParams */
457+ List * curOuterParams ;
376458
377459 /*
378460 * These fields are workspace for setrefs.c. Each is an array
0 commit comments