mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.259 2009/05/09 22:51:41 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.260 2009/06/11 14:48:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,9 +63,9 @@ static FunctionScan *create_functionscan_plan(PlannerInfo *root, Path *best_path
|
||||
static ValuesScan *create_valuesscan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
List *tlist, List *scan_clauses);
|
||||
static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
List *tlist, List *scan_clauses);
|
||||
static NestLoop *create_nestloop_plan(PlannerInfo *root, NestPath *best_path,
|
||||
Plan *outer_plan, Plan *inner_plan);
|
||||
static MergeJoin *create_mergejoin_plan(PlannerInfo *root, MergePath *best_path,
|
||||
@ -98,9 +98,9 @@ static FunctionScan *make_functionscan(List *qptlist, List *qpqual,
|
||||
static ValuesScan *make_valuesscan(List *qptlist, List *qpqual,
|
||||
Index scanrelid, List *values_lists);
|
||||
static CteScan *make_ctescan(List *qptlist, List *qpqual,
|
||||
Index scanrelid, int ctePlanId, int cteParam);
|
||||
Index scanrelid, int ctePlanId, int cteParam);
|
||||
static WorkTableScan *make_worktablescan(List *qptlist, List *qpqual,
|
||||
Index scanrelid, int wtParam);
|
||||
Index scanrelid, int wtParam);
|
||||
static BitmapAnd *make_bitmap_and(List *bitmapplans);
|
||||
static BitmapOr *make_bitmap_or(List *bitmapplans);
|
||||
static NestLoop *make_nestloop(List *tlist,
|
||||
@ -113,10 +113,10 @@ static HashJoin *make_hashjoin(List *tlist,
|
||||
Plan *lefttree, Plan *righttree,
|
||||
JoinType jointype);
|
||||
static Hash *make_hash(Plan *lefttree,
|
||||
Oid skewTable,
|
||||
AttrNumber skewColumn,
|
||||
Oid skewColType,
|
||||
int32 skewColTypmod);
|
||||
Oid skewTable,
|
||||
AttrNumber skewColumn,
|
||||
Oid skewColType,
|
||||
int32 skewColTypmod);
|
||||
static MergeJoin *make_mergejoin(List *tlist,
|
||||
List *joinclauses, List *otherclauses,
|
||||
List *mergeclauses,
|
||||
@ -329,7 +329,7 @@ build_relation_tlist(RelOptInfo *rel)
|
||||
foreach(v, rel->reltargetlist)
|
||||
{
|
||||
/* Do we really need to copy here? Not sure */
|
||||
Node *node = (Node *) copyObject(lfirst(v));
|
||||
Node *node = (Node *) copyObject(lfirst(v));
|
||||
|
||||
tlist = lappend(tlist, makeTargetEntry((Expr *) node,
|
||||
resno,
|
||||
@ -657,20 +657,20 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path)
|
||||
return subplan;
|
||||
|
||||
/*
|
||||
* As constructed, the subplan has a "flat" tlist containing just the
|
||||
* Vars needed here and at upper levels. The values we are supposed
|
||||
* to unique-ify may be expressions in these variables. We have to
|
||||
* add any such expressions to the subplan's tlist.
|
||||
* As constructed, the subplan has a "flat" tlist containing just the Vars
|
||||
* needed here and at upper levels. The values we are supposed to
|
||||
* unique-ify may be expressions in these variables. We have to add any
|
||||
* such expressions to the subplan's tlist.
|
||||
*
|
||||
* The subplan may have a "physical" tlist if it is a simple scan plan.
|
||||
* If we're going to sort, this should be reduced to the regular tlist,
|
||||
* so that we don't sort more data than we need to. For hashing, the
|
||||
* tlist should be left as-is if we don't need to add any expressions;
|
||||
* but if we do have to add expressions, then a projection step will be
|
||||
* needed at runtime anyway, so we may as well remove unneeded items.
|
||||
* Therefore newtlist starts from build_relation_tlist() not just a
|
||||
* copy of the subplan's tlist; and we don't install it into the subplan
|
||||
* unless we are sorting or stuff has to be added.
|
||||
* The subplan may have a "physical" tlist if it is a simple scan plan. If
|
||||
* we're going to sort, this should be reduced to the regular tlist, so
|
||||
* that we don't sort more data than we need to. For hashing, the tlist
|
||||
* should be left as-is if we don't need to add any expressions; but if we
|
||||
* do have to add expressions, then a projection step will be needed at
|
||||
* runtime anyway, so we may as well remove unneeded items. Therefore
|
||||
* newtlist starts from build_relation_tlist() not just a copy of the
|
||||
* subplan's tlist; and we don't install it into the subplan unless we are
|
||||
* sorting or stuff has to be added.
|
||||
*/
|
||||
in_operators = best_path->in_operators;
|
||||
uniq_exprs = best_path->uniq_exprs;
|
||||
@ -1063,10 +1063,10 @@ create_bitmap_scan_plan(PlannerInfo *root,
|
||||
qpqual = order_qual_clauses(root, qpqual);
|
||||
|
||||
/*
|
||||
* When dealing with special operators, we will at this point
|
||||
* have duplicate clauses in qpqual and bitmapqualorig. We may as well
|
||||
* drop 'em from bitmapqualorig, since there's no point in making the
|
||||
* tests twice.
|
||||
* When dealing with special operators, we will at this point have
|
||||
* duplicate clauses in qpqual and bitmapqualorig. We may as well drop
|
||||
* 'em from bitmapqualorig, since there's no point in making the tests
|
||||
* twice.
|
||||
*/
|
||||
bitmapqualorig = list_difference_ptr(bitmapqualorig, qpqual);
|
||||
|
||||
@ -1414,10 +1414,10 @@ static CteScan *
|
||||
create_ctescan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses)
|
||||
{
|
||||
CteScan *scan_plan;
|
||||
CteScan *scan_plan;
|
||||
Index scan_relid = best_path->parent->relid;
|
||||
RangeTblEntry *rte;
|
||||
SubPlan *ctesplan = NULL;
|
||||
SubPlan *ctesplan = NULL;
|
||||
int plan_id;
|
||||
int cte_param_id;
|
||||
PlannerInfo *cteroot;
|
||||
@ -1441,6 +1441,7 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path,
|
||||
if (!cteroot) /* shouldn't happen */
|
||||
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: cte_plan_ids can be shorter than cteList, if we are still working
|
||||
* on planning the CTEs (ie, this is a side-reference from another CTE).
|
||||
@ -1471,8 +1472,8 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path,
|
||||
elog(ERROR, "could not find plan for CTE \"%s\"", rte->ctename);
|
||||
|
||||
/*
|
||||
* We need the CTE param ID, which is the sole member of the
|
||||
* SubPlan's setParam list.
|
||||
* We need the CTE param ID, which is the sole member of the SubPlan's
|
||||
* setParam list.
|
||||
*/
|
||||
cte_param_id = linitial_int(ctesplan->setParam);
|
||||
|
||||
@ -1512,12 +1513,12 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path,
|
||||
|
||||
/*
|
||||
* We need to find the worktable param ID, which is in the plan level
|
||||
* that's processing the recursive UNION, which is one level *below*
|
||||
* where the CTE comes from.
|
||||
* that's processing the recursive UNION, which is one level *below* where
|
||||
* the CTE comes from.
|
||||
*/
|
||||
levelsup = rte->ctelevelsup;
|
||||
if (levelsup == 0) /* shouldn't happen */
|
||||
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
|
||||
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
|
||||
levelsup--;
|
||||
cteroot = root;
|
||||
while (levelsup-- > 0)
|
||||
@ -1526,7 +1527,7 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path,
|
||||
if (!cteroot) /* shouldn't happen */
|
||||
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
|
||||
}
|
||||
if (cteroot->wt_param_id < 0) /* shouldn't happen */
|
||||
if (cteroot->wt_param_id < 0) /* shouldn't happen */
|
||||
elog(ERROR, "could not find param ID for CTE \"%s\"", rte->ctename);
|
||||
|
||||
/* Sort clauses into best execution order */
|
||||
@ -1563,10 +1564,9 @@ create_nestloop_plan(PlannerInfo *root,
|
||||
NestLoop *join_plan;
|
||||
|
||||
/*
|
||||
* If the inner path is a nestloop inner indexscan, it might be using
|
||||
* some of the join quals as index quals, in which case we don't have
|
||||
* to check them again at the join node. Remove any join quals that
|
||||
* are redundant.
|
||||
* If the inner path is a nestloop inner indexscan, it might be using some
|
||||
* of the join quals as index quals, in which case we don't have to check
|
||||
* them again at the join node. Remove any join quals that are redundant.
|
||||
*/
|
||||
joinrestrictclauses =
|
||||
select_nonredundant_join_clauses(root,
|
||||
@ -1869,12 +1869,12 @@ create_hashjoin_plan(PlannerInfo *root,
|
||||
disuse_physical_tlist(outer_plan, best_path->jpath.outerjoinpath);
|
||||
|
||||
/*
|
||||
* If there is a single join clause and we can identify the outer
|
||||
* variable as a simple column reference, supply its identity for
|
||||
* possible use in skew optimization. (Note: in principle we could
|
||||
* do skew optimization with multiple join clauses, but we'd have to
|
||||
* be able to determine the most common combinations of outer values,
|
||||
* which we don't currently have enough stats for.)
|
||||
* If there is a single join clause and we can identify the outer variable
|
||||
* as a simple column reference, supply its identity for possible use in
|
||||
* skew optimization. (Note: in principle we could do skew optimization
|
||||
* with multiple join clauses, but we'd have to be able to determine the
|
||||
* most common combinations of outer values, which we don't currently have
|
||||
* enough stats for.)
|
||||
*/
|
||||
if (list_length(hashclauses) == 1)
|
||||
{
|
||||
@ -1887,7 +1887,7 @@ create_hashjoin_plan(PlannerInfo *root,
|
||||
node = (Node *) ((RelabelType *) node)->arg;
|
||||
if (IsA(node, Var))
|
||||
{
|
||||
Var *var = (Var *) node;
|
||||
Var *var = (Var *) node;
|
||||
RangeTblEntry *rte;
|
||||
|
||||
rte = root->simple_rte_array[var->varno];
|
||||
@ -2029,8 +2029,8 @@ fix_indexqual_references(List *indexquals, IndexPath *index_path)
|
||||
/* Never need to commute... */
|
||||
|
||||
/*
|
||||
* Determine which index attribute this is and change the
|
||||
* indexkey operand as needed.
|
||||
* Determine which index attribute this is and change the indexkey
|
||||
* operand as needed.
|
||||
*/
|
||||
linitial(saop->args) = fix_indexqual_operand(linitial(saop->args),
|
||||
index);
|
||||
@ -2506,7 +2506,7 @@ make_ctescan(List *qptlist,
|
||||
int ctePlanId,
|
||||
int cteParam)
|
||||
{
|
||||
CteScan *node = makeNode(CteScan);
|
||||
CteScan *node = makeNode(CteScan);
|
||||
Plan *plan = &node->scan.plan;
|
||||
|
||||
/* cost should be inserted by caller */
|
||||
@ -3282,7 +3282,7 @@ make_windowagg(PlannerInfo *root, List *tlist,
|
||||
{
|
||||
WindowAgg *node = makeNode(WindowAgg);
|
||||
Plan *plan = &node->plan;
|
||||
Path windowagg_path; /* dummy for result of cost_windowagg */
|
||||
Path windowagg_path; /* dummy for result of cost_windowagg */
|
||||
QualCost qual_cost;
|
||||
|
||||
node->winref = winref;
|
||||
@ -3294,7 +3294,7 @@ make_windowagg(PlannerInfo *root, List *tlist,
|
||||
node->ordOperators = ordOperators;
|
||||
node->frameOptions = frameOptions;
|
||||
|
||||
copy_plan_costsize(plan, lefttree); /* only care about copying size */
|
||||
copy_plan_costsize(plan, lefttree); /* only care about copying size */
|
||||
cost_windowagg(&windowagg_path, root,
|
||||
numWindowFuncs, partNumCols, ordNumCols,
|
||||
lefttree->startup_cost,
|
||||
|
Reference in New Issue
Block a user