mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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.
This commit is contained in:
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user