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