Commit de94e2af authored by Tom Lane's avatar Tom Lane

Run pgindent on a batch of (mostly-planner-related) source files.

Getting annoyed at the amount of unrelated chatter I get from pgindent'ing
Rowley's unique-joins patch.  Re-indent all the files it touches.
parent d25379eb
...@@ -317,9 +317,9 @@ static void postgresEndForeignModify(EState *estate, ...@@ -317,9 +317,9 @@ static void postgresEndForeignModify(EState *estate,
ResultRelInfo *resultRelInfo); ResultRelInfo *resultRelInfo);
static int postgresIsForeignRelUpdatable(Relation rel); static int postgresIsForeignRelUpdatable(Relation rel);
static bool postgresPlanDirectModify(PlannerInfo *root, static bool postgresPlanDirectModify(PlannerInfo *root,
ModifyTable *plan, ModifyTable *plan,
Index resultRelation, Index resultRelation,
int subplan_index); int subplan_index);
static void postgresBeginDirectModify(ForeignScanState *node, int eflags); static void postgresBeginDirectModify(ForeignScanState *node, int eflags);
static TupleTableSlot *postgresIterateDirectModify(ForeignScanState *node); static TupleTableSlot *postgresIterateDirectModify(ForeignScanState *node);
static void postgresEndDirectModify(ForeignScanState *node); static void postgresEndDirectModify(ForeignScanState *node);
...@@ -331,7 +331,7 @@ static void postgresExplainForeignModify(ModifyTableState *mtstate, ...@@ -331,7 +331,7 @@ static void postgresExplainForeignModify(ModifyTableState *mtstate,
int subplan_index, int subplan_index,
ExplainState *es); ExplainState *es);
static void postgresExplainDirectModify(ForeignScanState *node, static void postgresExplainDirectModify(ForeignScanState *node,
ExplainState *es); ExplainState *es);
static bool postgresAnalyzeForeignTable(Relation relation, static bool postgresAnalyzeForeignTable(Relation relation,
AcquireSampleRowsFunc *func, AcquireSampleRowsFunc *func,
BlockNumber *totalpages); BlockNumber *totalpages);
...@@ -2101,8 +2101,8 @@ postgresPlanDirectModify(PlannerInfo *root, ...@@ -2101,8 +2101,8 @@ postgresPlanDirectModify(PlannerInfo *root,
int col; int col;
/* /*
* We transmit only columns that were explicitly targets of the UPDATE, * We transmit only columns that were explicitly targets of the
* so as to avoid unnecessary data transmission. * UPDATE, so as to avoid unnecessary data transmission.
*/ */
col = -1; col = -1;
while ((col = bms_next_member(rte->updatedCols, col)) >= 0) while ((col = bms_next_member(rte->updatedCols, col)) >= 0)
...@@ -2242,17 +2242,17 @@ postgresBeginDirectModify(ForeignScanState *node, int eflags) ...@@ -2242,17 +2242,17 @@ postgresBeginDirectModify(ForeignScanState *node, int eflags)
dmstate->conn = GetConnection(user, false); dmstate->conn = GetConnection(user, false);
/* Initialize state variable */ /* Initialize state variable */
dmstate->num_tuples = -1; /* -1 means not set yet */ dmstate->num_tuples = -1; /* -1 means not set yet */
/* Get private info created by planner functions. */ /* Get private info created by planner functions. */
dmstate->query = strVal(list_nth(fsplan->fdw_private, dmstate->query = strVal(list_nth(fsplan->fdw_private,
FdwDirectModifyPrivateUpdateSql)); FdwDirectModifyPrivateUpdateSql));
dmstate->has_returning = intVal(list_nth(fsplan->fdw_private, dmstate->has_returning = intVal(list_nth(fsplan->fdw_private,
FdwDirectModifyPrivateHasReturning)); FdwDirectModifyPrivateHasReturning));
dmstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private, dmstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private,
FdwDirectModifyPrivateRetrievedAttrs); FdwDirectModifyPrivateRetrievedAttrs);
dmstate->set_processed = intVal(list_nth(fsplan->fdw_private, dmstate->set_processed = intVal(list_nth(fsplan->fdw_private,
FdwDirectModifyPrivateSetProcessed)); FdwDirectModifyPrivateSetProcessed));
/* Create context for per-tuple temp workspace. */ /* Create context for per-tuple temp workspace. */
dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt, dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
...@@ -3911,10 +3911,10 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, ...@@ -3911,10 +3911,10 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype,
List *otherclauses; List *otherclauses;
/* /*
* Core code may call GetForeignJoinPaths hook even when the join * Core code may call GetForeignJoinPaths hook even when the join relation
* relation doesn't have a valid user mapping associated with it. See * doesn't have a valid user mapping associated with it. See
* build_join_rel() for details. We can't push down such join, since * build_join_rel() for details. We can't push down such join, since there
* there doesn't exist a user mapping which can be used to connect to the * doesn't exist a user mapping which can be used to connect to the
* foreign server. * foreign server.
*/ */
if (!OidIsValid(joinrel->umid)) if (!OidIsValid(joinrel->umid))
......
...@@ -574,7 +574,7 @@ void ...@@ -574,7 +574,7 @@ void
ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc) ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
{ {
Bitmapset *rels_used = NULL; Bitmapset *rels_used = NULL;
PlanState *ps; PlanState *ps;
Assert(queryDesc->plannedstmt != NULL); Assert(queryDesc->plannedstmt != NULL);
es->pstmt = queryDesc->plannedstmt; es->pstmt = queryDesc->plannedstmt;
...@@ -1333,7 +1333,7 @@ ExplainNode(PlanState *planstate, List *ancestors, ...@@ -1333,7 +1333,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
break; break;
case T_Gather: case T_Gather:
{ {
Gather *gather = (Gather *) plan; Gather *gather = (Gather *) plan;
show_scan_qual(plan->qual, "Filter", planstate, ancestors, es); show_scan_qual(plan->qual, "Filter", planstate, ancestors, es);
if (plan->qual) if (plan->qual)
...@@ -1343,7 +1343,7 @@ ExplainNode(PlanState *planstate, List *ancestors, ...@@ -1343,7 +1343,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
gather->num_workers, es); gather->num_workers, es);
if (gather->single_copy) if (gather->single_copy)
ExplainPropertyText("Single Copy", ExplainPropertyText("Single Copy",
gather->single_copy ? "true" : "false", gather->single_copy ? "true" : "false",
es); es);
} }
break; break;
...@@ -1514,8 +1514,8 @@ ExplainNode(PlanState *planstate, List *ancestors, ...@@ -1514,8 +1514,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
appendStringInfo(es->str, "Worker %d: ", n); appendStringInfo(es->str, "Worker %d: ", n);
if (es->timing) if (es->timing)
appendStringInfo(es->str, appendStringInfo(es->str,
"actual time=%.3f..%.3f rows=%.0f loops=%.0f\n", "actual time=%.3f..%.3f rows=%.0f loops=%.0f\n",
startup_sec, total_sec, rows, nloops); startup_sec, total_sec, rows, nloops);
else else
appendStringInfo(es->str, appendStringInfo(es->str,
"actual rows=%.0f loops=%.0f\n", "actual rows=%.0f loops=%.0f\n",
...@@ -1671,6 +1671,7 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es) ...@@ -1671,6 +1671,7 @@ show_plan_tlist(PlanState *planstate, List *ancestors, ExplainState *es)
return; return;
if (IsA(plan, RecursiveUnion)) if (IsA(plan, RecursiveUnion))
return; return;
/* /*
* Likewise for ForeignScan that executes a direct INSERT/UPDATE/DELETE * Likewise for ForeignScan that executes a direct INSERT/UPDATE/DELETE
* *
...@@ -2329,7 +2330,7 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage) ...@@ -2329,7 +2330,7 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage)
bool has_temp = (usage->temp_blks_read > 0 || bool has_temp = (usage->temp_blks_read > 0 ||
usage->temp_blks_written > 0); usage->temp_blks_written > 0);
bool has_timing = (!INSTR_TIME_IS_ZERO(usage->blk_read_time) || bool has_timing = (!INSTR_TIME_IS_ZERO(usage->blk_read_time) ||
!INSTR_TIME_IS_ZERO(usage->blk_write_time)); !INSTR_TIME_IS_ZERO(usage->blk_write_time));
/* Show only positive counter values. */ /* Show only positive counter values. */
if (has_shared || has_local || has_temp) if (has_shared || has_local || has_temp)
...@@ -2393,10 +2394,10 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage) ...@@ -2393,10 +2394,10 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage)
appendStringInfoString(es->str, "I/O Timings:"); appendStringInfoString(es->str, "I/O Timings:");
if (!INSTR_TIME_IS_ZERO(usage->blk_read_time)) if (!INSTR_TIME_IS_ZERO(usage->blk_read_time))
appendStringInfo(es->str, " read=%0.3f", appendStringInfo(es->str, " read=%0.3f",
INSTR_TIME_GET_MILLISEC(usage->blk_read_time)); INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
if (!INSTR_TIME_IS_ZERO(usage->blk_write_time)) if (!INSTR_TIME_IS_ZERO(usage->blk_write_time))
appendStringInfo(es->str, " write=%0.3f", appendStringInfo(es->str, " write=%0.3f",
INSTR_TIME_GET_MILLISEC(usage->blk_write_time)); INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
appendStringInfoChar(es->str, '\n'); appendStringInfoChar(es->str, '\n');
} }
} }
......
...@@ -4203,7 +4203,7 @@ _copyList(const List *from) ...@@ -4203,7 +4203,7 @@ _copyList(const List *from)
static ExtensibleNode * static ExtensibleNode *
_copyExtensibleNode(const ExtensibleNode *from) _copyExtensibleNode(const ExtensibleNode *from)
{ {
ExtensibleNode *newnode; ExtensibleNode *newnode;
const ExtensibleNodeMethods *methods; const ExtensibleNodeMethods *methods;
methods = GetExtensibleNodeMethods(from->extnodename, false); methods = GetExtensibleNodeMethods(from->extnodename, false);
......
...@@ -879,7 +879,7 @@ _equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b) ...@@ -879,7 +879,7 @@ _equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b)
static bool static bool
_equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b) _equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b)
{ {
const ExtensibleNodeMethods *methods; const ExtensibleNodeMethods *methods;
COMPARE_STRING_FIELD(extnodename); COMPARE_STRING_FIELD(extnodename);
......
...@@ -2332,7 +2332,7 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node) ...@@ -2332,7 +2332,7 @@ _outPlannerParamItem(StringInfo str, const PlannerParamItem *node)
static void static void
_outExtensibleNode(StringInfo str, const ExtensibleNode *node) _outExtensibleNode(StringInfo str, const ExtensibleNode *node)
{ {
const ExtensibleNodeMethods *methods; const ExtensibleNodeMethods *methods;
methods = GetExtensibleNodeMethods(node->extnodename, false); methods = GetExtensibleNodeMethods(node->extnodename, false);
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* plan nodes below the LIMIT node) are set without regard to any LIMIT, so * plan nodes below the LIMIT node) are set without regard to any LIMIT, so
* that this equation works properly. (Note: while path->rows is never zero * that this equation works properly. (Note: while path->rows is never zero
* for ordinary relations, it is zero for paths for provably-empty relations, * for ordinary relations, it is zero for paths for provably-empty relations,
* so beware of division-by-zero.) The LIMIT is applied as a top-level * so beware of division-by-zero.) The LIMIT is applied as a top-level
* plan node. * plan node.
* *
* For largely historical reasons, most of the routines in this module use * For largely historical reasons, most of the routines in this module use
...@@ -231,8 +231,8 @@ cost_seqscan(Path *path, PlannerInfo *root, ...@@ -231,8 +231,8 @@ cost_seqscan(Path *path, PlannerInfo *root,
/* Adjust costing for parallelism, if used. */ /* Adjust costing for parallelism, if used. */
if (path->parallel_degree > 0) if (path->parallel_degree > 0)
{ {
double parallel_divisor = path->parallel_degree; double parallel_divisor = path->parallel_degree;
double leader_contribution; double leader_contribution;
/* /*
* Early experience with parallel query suggests that when there is * Early experience with parallel query suggests that when there is
......
...@@ -348,12 +348,12 @@ try_nestloop_path(PlannerInfo *root, ...@@ -348,12 +348,12 @@ try_nestloop_path(PlannerInfo *root,
*/ */
static void static void
try_partial_nestloop_path(PlannerInfo *root, try_partial_nestloop_path(PlannerInfo *root,
RelOptInfo *joinrel, RelOptInfo *joinrel,
Path *outer_path, Path *outer_path,
Path *inner_path, Path *inner_path,
List *pathkeys, List *pathkeys,
JoinType jointype, JoinType jointype,
JoinPathExtraData *extra) JoinPathExtraData *extra)
{ {
JoinCostWorkspace workspace; JoinCostWorkspace workspace;
...@@ -373,8 +373,8 @@ try_partial_nestloop_path(PlannerInfo *root, ...@@ -373,8 +373,8 @@ try_partial_nestloop_path(PlannerInfo *root,
} }
/* /*
* Before creating a path, get a quick lower bound on what it is likely * Before creating a path, get a quick lower bound on what it is likely to
* to cost. Bail out right away if it looks terrible. * cost. Bail out right away if it looks terrible.
*/ */
initial_cost_nestloop(root, &workspace, jointype, initial_cost_nestloop(root, &workspace, jointype,
outer_path, inner_path, outer_path, inner_path,
...@@ -384,17 +384,17 @@ try_partial_nestloop_path(PlannerInfo *root, ...@@ -384,17 +384,17 @@ try_partial_nestloop_path(PlannerInfo *root,
/* Might be good enough to be worth trying, so let's try it. */ /* Might be good enough to be worth trying, so let's try it. */
add_partial_path(joinrel, (Path *) add_partial_path(joinrel, (Path *)
create_nestloop_path(root, create_nestloop_path(root,
joinrel, joinrel,
jointype, jointype,
&workspace, &workspace,
extra->sjinfo, extra->sjinfo,
&extra->semifactors, &extra->semifactors,
outer_path, outer_path,
inner_path, inner_path,
extra->restrictlist, extra->restrictlist,
pathkeys, pathkeys,
NULL)); NULL));
} }
/* /*
...@@ -571,8 +571,8 @@ try_partial_hashjoin_path(PlannerInfo *root, ...@@ -571,8 +571,8 @@ try_partial_hashjoin_path(PlannerInfo *root,
} }
/* /*
* Before creating a path, get a quick lower bound on what it is likely * Before creating a path, get a quick lower bound on what it is likely to
* to cost. Bail out right away if it looks terrible. * cost. Bail out right away if it looks terrible.
*/ */
initial_cost_hashjoin(root, &workspace, jointype, hashclauses, initial_cost_hashjoin(root, &workspace, jointype, hashclauses,
outer_path, inner_path, outer_path, inner_path,
...@@ -582,17 +582,17 @@ try_partial_hashjoin_path(PlannerInfo *root, ...@@ -582,17 +582,17 @@ try_partial_hashjoin_path(PlannerInfo *root,
/* Might be good enough to be worth trying, so let's try it. */ /* Might be good enough to be worth trying, so let's try it. */
add_partial_path(joinrel, (Path *) add_partial_path(joinrel, (Path *)
create_hashjoin_path(root, create_hashjoin_path(root,
joinrel, joinrel,
jointype, jointype,
&workspace, &workspace,
extra->sjinfo, extra->sjinfo,
&extra->semifactors, &extra->semifactors,
outer_path, outer_path,
inner_path, inner_path,
extra->restrictlist, extra->restrictlist,
NULL, NULL,
hashclauses)); hashclauses));
} }
/* /*
...@@ -1189,11 +1189,11 @@ match_unsorted_outer(PlannerInfo *root, ...@@ -1189,11 +1189,11 @@ match_unsorted_outer(PlannerInfo *root,
} }
/* /*
* If the joinrel is parallel-safe and the join type supports nested loops, * If the joinrel is parallel-safe and the join type supports nested
* we may be able to consider a partial nestloop plan. However, we can't * loops, we may be able to consider a partial nestloop plan. However, we
* handle JOIN_UNIQUE_OUTER, because the outer path will be partial, and * can't handle JOIN_UNIQUE_OUTER, because the outer path will be partial,
* therefore we won't be able to properly guarantee uniqueness. Nor can * and therefore we won't be able to properly guarantee uniqueness. Nor
* we handle extra_lateral_rels, since partial paths must not be * can we handle extra_lateral_rels, since partial paths must not be
* parameterized. * parameterized.
*/ */
if (joinrel->consider_parallel && nestjoinOK && if (joinrel->consider_parallel && nestjoinOK &&
...@@ -1235,10 +1235,10 @@ consider_parallel_nestloop(PlannerInfo *root, ...@@ -1235,10 +1235,10 @@ consider_parallel_nestloop(PlannerInfo *root,
outerpath->pathkeys); outerpath->pathkeys);
/* /*
* Try the cheapest parameterized paths; only those which will * Try the cheapest parameterized paths; only those which will produce
* produce an unparameterized path when joined to this outerrel * an unparameterized path when joined to this outerrel will survive
* will survive try_partial_nestloop_path. The cheapest * try_partial_nestloop_path. The cheapest unparameterized path is
* unparameterized path is also in this list. * also in this list.
*/ */
foreach(lc2, innerrel->cheapest_parameterized_paths) foreach(lc2, innerrel->cheapest_parameterized_paths)
{ {
...@@ -1250,16 +1250,17 @@ consider_parallel_nestloop(PlannerInfo *root, ...@@ -1250,16 +1250,17 @@ consider_parallel_nestloop(PlannerInfo *root,
/* /*
* Like match_unsorted_outer, we only consider a single nestloop * Like match_unsorted_outer, we only consider a single nestloop
* path when the jointype is JOIN_UNIQUE_INNER. But we have to scan * path when the jointype is JOIN_UNIQUE_INNER. But we have to
* cheapest_parameterized_paths to find the one we want to consider, * scan cheapest_parameterized_paths to find the one we want to
* because cheapest_total_path might not be parallel-safe. * consider, because cheapest_total_path might not be
* parallel-safe.
*/ */
if (jointype == JOIN_UNIQUE_INNER) if (jointype == JOIN_UNIQUE_INNER)
{ {
if (!bms_is_empty(PATH_REQ_OUTER(innerpath))) if (!bms_is_empty(PATH_REQ_OUTER(innerpath)))
continue; continue;
innerpath = (Path *) create_unique_path(root, innerrel, innerpath = (Path *) create_unique_path(root, innerrel,
innerpath, extra->sjinfo); innerpath, extra->sjinfo);
Assert(innerpath); Assert(innerpath);
} }
...@@ -1456,8 +1457,8 @@ hash_inner_and_outer(PlannerInfo *root, ...@@ -1456,8 +1457,8 @@ hash_inner_and_outer(PlannerInfo *root,
outerrel->partial_pathlist != NIL && outerrel->partial_pathlist != NIL &&
bms_is_empty(joinrel->lateral_relids)) bms_is_empty(joinrel->lateral_relids))
{ {
Path *cheapest_partial_outer; Path *cheapest_partial_outer;
Path *cheapest_safe_inner = NULL; Path *cheapest_safe_inner = NULL;
cheapest_partial_outer = cheapest_partial_outer =
(Path *) linitial(outerrel->partial_pathlist); (Path *) linitial(outerrel->partial_pathlist);
......
...@@ -70,10 +70,10 @@ query_planner(PlannerInfo *root, List *tlist, ...@@ -70,10 +70,10 @@ query_planner(PlannerInfo *root, List *tlist,
final_rel = build_empty_join_rel(root); final_rel = build_empty_join_rel(root);
/* /*
* If query allows parallelism in general, check whether the quals * If query allows parallelism in general, check whether the quals are
* are parallel-restricted. There's currently no real benefit to * parallel-restricted. There's currently no real benefit to setting
* setting this flag correctly because we can't yet reference subplans * this flag correctly because we can't yet reference subplans from
* from parallel workers. But that might change someday, so set this * parallel workers. But that might change someday, so set this
* correctly anyway. * correctly anyway.
*/ */
if (root->glob->parallelModeOK) if (root->glob->parallelModeOK)
......
...@@ -105,7 +105,7 @@ static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context); ...@@ -105,7 +105,7 @@ static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context);
static void set_join_references(PlannerInfo *root, Join *join, int rtoffset); static void set_join_references(PlannerInfo *root, Join *join, int rtoffset);
static void set_upper_references(PlannerInfo *root, Plan *plan, int rtoffset); static void set_upper_references(PlannerInfo *root, Plan *plan, int rtoffset);
static void set_combineagg_references(PlannerInfo *root, Plan *plan, static void set_combineagg_references(PlannerInfo *root, Plan *plan,
int rtoffset); int rtoffset);
static void set_dummy_tlist_references(Plan *plan, int rtoffset); static void set_dummy_tlist_references(Plan *plan, int rtoffset);
static indexed_tlist *build_tlist_index(List *tlist); static indexed_tlist *build_tlist_index(List *tlist);
static Var *search_indexed_tlist_for_var(Var *var, static Var *search_indexed_tlist_for_var(Var *var,
...@@ -120,7 +120,7 @@ static Var *search_indexed_tlist_for_sortgroupref(Node *node, ...@@ -120,7 +120,7 @@ static Var *search_indexed_tlist_for_sortgroupref(Node *node,
indexed_tlist *itlist, indexed_tlist *itlist,
Index newvarno); Index newvarno);
static Var *search_indexed_tlist_for_partial_aggref(Aggref *aggref, static Var *search_indexed_tlist_for_partial_aggref(Aggref *aggref,
indexed_tlist *itlist, Index newvarno); indexed_tlist *itlist, Index newvarno);
static List *fix_join_expr(PlannerInfo *root, static List *fix_join_expr(PlannerInfo *root,
List *clauses, List *clauses,
indexed_tlist *outer_itlist, indexed_tlist *outer_itlist,
...@@ -136,12 +136,12 @@ static Node *fix_upper_expr(PlannerInfo *root, ...@@ -136,12 +136,12 @@ static Node *fix_upper_expr(PlannerInfo *root,
static Node *fix_upper_expr_mutator(Node *node, static Node *fix_upper_expr_mutator(Node *node,
fix_upper_expr_context *context); fix_upper_expr_context *context);
static Node *fix_combine_agg_expr(PlannerInfo *root, static Node *fix_combine_agg_expr(PlannerInfo *root,
Node *node, Node *node,
indexed_tlist *subplan_itlist, indexed_tlist *subplan_itlist,
Index newvarno, Index newvarno,
int rtoffset); int rtoffset);
static Node *fix_combine_agg_expr_mutator(Node *node, static Node *fix_combine_agg_expr_mutator(Node *node,
fix_upper_expr_context *context); fix_upper_expr_context *context);
static List *set_returning_clause_references(PlannerInfo *root, static List *set_returning_clause_references(PlannerInfo *root,
List *rlist, List *rlist,
Plan *topplan, Plan *topplan,
...@@ -679,7 +679,7 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset) ...@@ -679,7 +679,7 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
break; break;
case T_Agg: case T_Agg:
{ {
Agg *aggplan = (Agg *) plan; Agg *aggplan = (Agg *) plan;
if (aggplan->combineStates) if (aggplan->combineStates)
set_combineagg_references(root, plan, rtoffset); set_combineagg_references(root, plan, rtoffset);
...@@ -2066,7 +2066,7 @@ static Var * ...@@ -2066,7 +2066,7 @@ static Var *
search_indexed_tlist_for_partial_aggref(Aggref *aggref, indexed_tlist *itlist, search_indexed_tlist_for_partial_aggref(Aggref *aggref, indexed_tlist *itlist,
Index newvarno) Index newvarno)
{ {
ListCell *lc; ListCell *lc;
foreach(lc, itlist->tlist) foreach(lc, itlist->tlist)
{ {
...@@ -2106,7 +2106,7 @@ search_indexed_tlist_for_partial_aggref(Aggref *aggref, indexed_tlist *itlist, ...@@ -2106,7 +2106,7 @@ search_indexed_tlist_for_partial_aggref(Aggref *aggref, indexed_tlist *itlist,
continue; continue;
newvar = makeVarFromTargetEntry(newvarno, tle); newvar = makeVarFromTargetEntry(newvarno, tle);
newvar->varnoold = 0; /* wasn't ever a plain Var */ newvar->varnoold = 0; /* wasn't ever a plain Var */
newvar->varoattno = 0; newvar->varoattno = 0;
return newvar; return newvar;
...@@ -2392,10 +2392,10 @@ fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context) ...@@ -2392,10 +2392,10 @@ fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context)
*/ */
static Node * static Node *
fix_combine_agg_expr(PlannerInfo *root, fix_combine_agg_expr(PlannerInfo *root,
Node *node, Node *node,
indexed_tlist *subplan_itlist, indexed_tlist *subplan_itlist,
Index newvarno, Index newvarno,
int rtoffset) int rtoffset)
{ {
fix_upper_expr_context context; fix_upper_expr_context context;
...@@ -2445,15 +2445,15 @@ fix_combine_agg_expr_mutator(Node *node, fix_upper_expr_context *context) ...@@ -2445,15 +2445,15 @@ fix_combine_agg_expr_mutator(Node *node, fix_upper_expr_context *context)
return fix_param_node(context->root, (Param *) node); return fix_param_node(context->root, (Param *) node);
if (IsA(node, Aggref)) if (IsA(node, Aggref))
{ {
Aggref *aggref = (Aggref *) node; Aggref *aggref = (Aggref *) node;
newvar = search_indexed_tlist_for_partial_aggref(aggref, newvar = search_indexed_tlist_for_partial_aggref(aggref,
context->subplan_itlist, context->subplan_itlist,
context->newvarno); context->newvarno);
if (newvar) if (newvar)
{ {
Aggref *newaggref; Aggref *newaggref;
TargetEntry *newtle; TargetEntry *newtle;
/* /*
* Now build a new TargetEntry for the Aggref's arguments which is * Now build a new TargetEntry for the Aggref's arguments which is
......
...@@ -175,8 +175,8 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind) ...@@ -175,8 +175,8 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
/* /*
* This should match what ExecCheckRTEPerms() does. * This should match what ExecCheckRTEPerms() does.
* *
* Note that if the plan ends up depending on the user OID in any * Note that if the plan ends up depending on the user OID in any way
* way - e.g. if it depends on the computed user mapping OID - we must * - e.g. if it depends on the computed user mapping OID - we must
* ensure that it gets invalidated in the case of a user OID change. * ensure that it gets invalidated in the case of a user OID change.
* See RevalidateCachedQuery and more generally the hasForeignJoin * See RevalidateCachedQuery and more generally the hasForeignJoin
* flags in PlannerGlobal and PlannedStmt. * flags in PlannerGlobal and PlannedStmt.
...@@ -185,7 +185,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind) ...@@ -185,7 +185,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
* InvalidOid even though rel->serverid is set. That just means there * InvalidOid even though rel->serverid is set. That just means there
* is a server with no user mapping. * is a server with no user mapping.
*/ */
Oid userid; Oid userid;
userid = OidIsValid(rte->checkAsUser) ? rte->checkAsUser : GetUserId(); userid = OidIsValid(rte->checkAsUser) ? rte->checkAsUser : GetUserId();
rel->umid = GetUserMappingId(userid, rel->serverid, true); rel->umid = GetUserMappingId(userid, rel->serverid, true);
...@@ -434,16 +434,16 @@ build_join_rel(PlannerInfo *root, ...@@ -434,16 +434,16 @@ build_join_rel(PlannerInfo *root,
/* /*
* Set up foreign-join fields if outer and inner relation are foreign * Set up foreign-join fields if outer and inner relation are foreign
* tables (or joins) belonging to the same server and using the same * tables (or joins) belonging to the same server and using the same user
* user mapping. * mapping.
* *
* Otherwise those fields are left invalid, so FDW API will not be called * Otherwise those fields are left invalid, so FDW API will not be called
* for the join relation. * for the join relation.
* *
* For FDWs like file_fdw, which ignore user mapping, the user mapping id * For FDWs like file_fdw, which ignore user mapping, the user mapping id
* associated with the joining relation may be invalid. A valid serverid * associated with the joining relation may be invalid. A valid serverid
* distinguishes between a pushed down join with no user mapping and * distinguishes between a pushed down join with no user mapping and a
* a join which can not be pushed down because of user mapping mismatch. * join which can not be pushed down because of user mapping mismatch.
*/ */
if (OidIsValid(outer_rel->serverid) && if (OidIsValid(outer_rel->serverid) &&
inner_rel->serverid == outer_rel->serverid && inner_rel->serverid == outer_rel->serverid &&
......
...@@ -1887,7 +1887,7 @@ flatten_grouping_sets(Node *expr, bool toplevel, bool *hasGroupingSets) ...@@ -1887,7 +1887,7 @@ flatten_grouping_sets(Node *expr, bool toplevel, bool *hasGroupingSets)
Node *n2 = flatten_grouping_sets(n1, false, NULL); Node *n2 = flatten_grouping_sets(n1, false, NULL);
if (IsA(n1, GroupingSet) && if (IsA(n1, GroupingSet) &&
((GroupingSet *)n1)->kind == GROUPING_SET_SETS) ((GroupingSet *) n1)->kind == GROUPING_SET_SETS)
{ {
result_set = list_concat(result_set, (List *) n2); result_set = list_concat(result_set, (List *) n2);
} }
...@@ -2869,7 +2869,7 @@ transformOnConflictArbiter(ParseState *pstate, ...@@ -2869,7 +2869,7 @@ transformOnConflictArbiter(ParseState *pstate,
if (IsCatalogRelation(pstate->p_target_relation)) if (IsCatalogRelation(pstate->p_target_relation))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ON CONFLICT is not supported with system catalog tables"), errmsg("ON CONFLICT is not supported with system catalog tables"),
parser_errposition(pstate, parser_errposition(pstate,
exprLocation((Node *) onConflictClause)))); exprLocation((Node *) onConflictClause))));
......
...@@ -550,11 +550,11 @@ extern PGDLLIMPORT Node *newNodeMacroHolder; ...@@ -550,11 +550,11 @@ extern PGDLLIMPORT Node *newNodeMacroHolder;
*/ */
extern char *nodeToString(const void *obj); extern char *nodeToString(const void *obj);
struct Bitmapset; /* not to include bitmapset.h here */ struct Bitmapset; /* not to include bitmapset.h here */
struct StringInfoData; /* not to include stringinfo.h here */ struct StringInfoData; /* not to include stringinfo.h here */
extern void outToken(struct StringInfoData *str, const char *s); extern void outToken(struct StringInfoData *str, const char *s);
extern void outBitmapset(struct StringInfoData *str, extern void outBitmapset(struct StringInfoData *str,
const struct Bitmapset *bms); const struct Bitmapset *bms);
/* /*
* nodes/{readfuncs.c,read.c} * nodes/{readfuncs.c,read.c}
......
...@@ -126,7 +126,7 @@ typedef struct PlannerGlobal ...@@ -126,7 +126,7 @@ typedef struct PlannerGlobal
bool wholePlanParallelSafe; /* is the entire plan parallel safe? */ bool wholePlanParallelSafe; /* is the entire plan parallel safe? */
bool hasForeignJoin; /* does have a pushed down foreign join */ bool hasForeignJoin; /* does have a pushed down foreign join */
} PlannerGlobal; } PlannerGlobal;
/* macro for fetching the Plan associated with a SubPlan node */ /* macro for fetching the Plan associated with a SubPlan node */
...@@ -494,7 +494,7 @@ typedef struct RelOptInfo ...@@ -494,7 +494,7 @@ typedef struct RelOptInfo
/* materialization information */ /* materialization information */
List *pathlist; /* Path structures */ List *pathlist; /* Path structures */
List *ppilist; /* ParamPathInfos used in pathlist */ List *ppilist; /* ParamPathInfos used in pathlist */
List *partial_pathlist; /* partial Paths */ List *partial_pathlist; /* partial Paths */
struct Path *cheapest_startup_path; struct Path *cheapest_startup_path;
struct Path *cheapest_total_path; struct Path *cheapest_total_path;
struct Path *cheapest_unique_path; struct Path *cheapest_unique_path;
...@@ -524,7 +524,8 @@ typedef struct RelOptInfo ...@@ -524,7 +524,8 @@ typedef struct RelOptInfo
/* Information about foreign tables and foreign joins */ /* Information about foreign tables and foreign joins */
Oid serverid; /* identifies server for the table or join */ Oid serverid; /* identifies server for the table or join */
Oid umid; /* identifies user mapping for the table or join */ Oid umid; /* identifies user mapping for the table or
* join */
/* use "struct FdwRoutine" to avoid including fdwapi.h here */ /* use "struct FdwRoutine" to avoid including fdwapi.h here */
struct FdwRoutine *fdwroutine; struct FdwRoutine *fdwroutine;
void *fdw_private; void *fdw_private;
...@@ -848,7 +849,7 @@ typedef struct Path ...@@ -848,7 +849,7 @@ typedef struct Path
bool parallel_aware; /* engage parallel-aware logic? */ bool parallel_aware; /* engage parallel-aware logic? */
bool parallel_safe; /* OK to use as part of parallel plan? */ bool parallel_safe; /* OK to use as part of parallel plan? */
int parallel_degree; /* desired parallel degree; 0 = not parallel */ int parallel_degree; /* desired parallel degree; 0 = not parallel */
/* estimated size/costs for path (see costsize.c for more info) */ /* estimated size/costs for path (see costsize.c for more info) */
double rows; /* estimated number of result tuples */ double rows; /* estimated number of result tuples */
......
...@@ -23,12 +23,12 @@ typedef enum ...@@ -23,12 +23,12 @@ typedef enum
FORCE_PARALLEL_OFF, FORCE_PARALLEL_OFF,
FORCE_PARALLEL_ON, FORCE_PARALLEL_ON,
FORCE_PARALLEL_REGRESS FORCE_PARALLEL_REGRESS
} ForceParallelMode; } ForceParallelMode;
/* GUC parameters */ /* GUC parameters */
#define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
extern double cursor_tuple_fraction; extern double cursor_tuple_fraction;
extern int force_parallel_mode; extern int force_parallel_mode;
/* query_planner callback to compute query_pathkeys */ /* query_planner callback to compute query_pathkeys */
typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra); typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
...@@ -55,6 +55,7 @@ extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual, ...@@ -55,6 +55,7 @@ extern ForeignScan *make_foreignscan(List *qptlist, List *qpqual,
extern Plan *materialize_finished_plan(Plan *subplan); extern Plan *materialize_finished_plan(Plan *subplan);
extern bool is_projection_capable_path(Path *path); extern bool is_projection_capable_path(Path *path);
extern bool is_projection_capable_plan(Plan *plan); extern bool is_projection_capable_plan(Plan *plan);
/* External use of these functions is deprecated: */ /* External use of these functions is deprecated: */
extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree); extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree);
extern Agg *make_agg(List *tlist, List *qual, AggStrategy aggstrategy, extern Agg *make_agg(List *tlist, List *qual, AggStrategy aggstrategy,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment