diff options
Diffstat (limited to 'src/backend/optimizer/util')
-rw-r--r-- | src/backend/optimizer/util/clauses.c | 55 | ||||
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 14 | ||||
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 32 | ||||
-rw-r--r-- | src/backend/optimizer/util/predtest.c | 47 | ||||
-rw-r--r-- | src/backend/optimizer/util/relnode.c | 11 | ||||
-rw-r--r-- | src/backend/optimizer/util/restrictinfo.c | 9 |
6 files changed, 97 insertions, 71 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 99d3147aeb..c9d9512b2f 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.221 2006/09/28 20:51:41 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.222 2006/10/04 00:29:55 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -403,7 +403,7 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts) Form_pg_aggregate aggform; Oid aggtranstype; int i; - ListCell *l; + ListCell *l; Assert(aggref->agglevelsup == 0); counts->numAggs++; @@ -887,7 +887,7 @@ contain_nonstrict_functions_walker(Node *node, void *context) * * Returns the set of all Relids that are referenced in the clause in such * a way that the clause cannot possibly return TRUE if any of these Relids - * is an all-NULL row. (It is OK to err on the side of conservatism; hence + * is an all-NULL row. (It is OK to err on the side of conservatism; hence * the analysis here is simplistic.) * * The semantics here are subtly different from contain_nonstrict_functions: @@ -1020,7 +1020,7 @@ find_nonnullable_rels_walker(Node *node, bool top_level) static bool is_strict_saop(ScalarArrayOpExpr *expr, bool falseOK) { - Node *rightop; + Node *rightop; /* The contained operator must be strict. */ if (!op_strict(expr->opno)) @@ -1288,12 +1288,13 @@ CommuteRowCompareExpr(RowCompareExpr *clause) } clause->opnos = newops; + /* - * Note: we don't bother to update the opclasses list, but just set - * it to empty. This is OK since this routine is currently only used - * for index quals, and the index machinery won't use the opclass - * information. The original opclass list is NOT valid if we have - * commuted any cross-type comparisons, so don't leave it in place. + * Note: we don't bother to update the opclasses list, but just set it to + * empty. This is OK since this routine is currently only used for index + * quals, and the index machinery won't use the opclass information. The + * original opclass list is NOT valid if we have commuted any cross-type + * comparisons, so don't leave it in place. */ clause->opclasses = NIL; /* XXX */ @@ -2109,9 +2110,9 @@ eval_const_expressions_mutator(Node *node, context); if (arg && IsA(arg, RowExpr)) { - RowExpr *rarg = (RowExpr *) arg; - List *newargs = NIL; - ListCell *l; + RowExpr *rarg = (RowExpr *) arg; + List *newargs = NIL; + ListCell *l; /* * We break ROW(...) IS [NOT] NULL into separate tests on its @@ -2120,15 +2121,15 @@ eval_const_expressions_mutator(Node *node, */ foreach(l, rarg->args) { - Node *relem = (Node *) lfirst(l); + Node *relem = (Node *) lfirst(l); /* - * A constant field refutes the whole NullTest if it's of - * the wrong nullness; else we can discard it. + * A constant field refutes the whole NullTest if it's of the + * wrong nullness; else we can discard it. */ if (relem && IsA(relem, Const)) { - Const *carg = (Const *) relem; + Const *carg = (Const *) relem; if (carg->constisnull ? (ntest->nulltesttype == IS_NOT_NULL) : @@ -2152,8 +2153,8 @@ eval_const_expressions_mutator(Node *node, } if (arg && IsA(arg, Const)) { - Const *carg = (Const *) arg; - bool result; + Const *carg = (Const *) arg; + bool result; switch (ntest->nulltesttype) { @@ -2166,7 +2167,7 @@ eval_const_expressions_mutator(Node *node, default: elog(ERROR, "unrecognized nulltesttype: %d", (int) ntest->nulltesttype); - result = false; /* keep compiler quiet */ + result = false; /* keep compiler quiet */ break; } @@ -2188,8 +2189,8 @@ eval_const_expressions_mutator(Node *node, context); if (arg && IsA(arg, Const)) { - Const *carg = (Const *) arg; - bool result; + Const *carg = (Const *) arg; + bool result; switch (btest->booltesttype) { @@ -2218,7 +2219,7 @@ eval_const_expressions_mutator(Node *node, default: elog(ERROR, "unrecognized booltesttype: %d", (int) btest->booltesttype); - result = false; /* keep compiler quiet */ + result = false; /* keep compiler quiet */ break; } @@ -3174,7 +3175,7 @@ expression_tree_walker(Node *node, break; case T_Aggref: { - Aggref *expr = (Aggref *) node; + Aggref *expr = (Aggref *) node; if (expression_tree_walker((Node *) expr->args, walker, context)) @@ -3452,8 +3453,8 @@ query_tree_walker(Query *query, if (query->utilityStmt) { /* - * Certain utility commands contain general-purpose Querys embedded - * in them --- if this is one, invoke the walker on the sub-Query. + * Certain utility commands contain general-purpose Querys embedded in + * them --- if this is one, invoke the walker on the sub-Query. */ if (IsA(query->utilityStmt, CopyStmt)) { @@ -3828,8 +3829,8 @@ expression_tree_mutator(Node *node, break; case T_RowCompareExpr: { - RowCompareExpr *rcexpr = (RowCompareExpr *) node; - RowCompareExpr *newnode; + RowCompareExpr *rcexpr = (RowCompareExpr *) node; + RowCompareExpr *newnode; FLATCOPY(newnode, rcexpr, RowCompareExpr); MUTATE(newnode->largs, rcexpr->largs, List *); diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 2cc79ed239..01f3151bee 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.132 2006/08/02 01:59:46 joe Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.133 2006/10/04 00:29:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -418,7 +418,7 @@ create_seqscan_path(PlannerInfo *root, RelOptInfo *rel) * for an ordered index, or NoMovementScanDirection for * an unordered index. * 'outer_rel' is the outer relation if this is a join inner indexscan path. - * (pathkeys and indexscandir are ignored if so.) NULL if not. + * (pathkeys and indexscandir are ignored if so.) NULL if not. * * Returns the new path node. */ @@ -680,12 +680,12 @@ create_result_path(List *quals) /* Ideally should define cost_result(), but I'm too lazy */ pathnode->path.startup_cost = 0; pathnode->path.total_cost = cpu_tuple_cost; + /* - * In theory we should include the qual eval cost as well, but - * at present that doesn't accomplish much except duplicate work that - * will be done again in make_result; since this is only used for - * degenerate cases, nothing interesting will be done with the path - * cost values... + * In theory we should include the qual eval cost as well, but at present + * that doesn't accomplish much except duplicate work that will be done + * again in make_result; since this is only used for degenerate cases, + * nothing interesting will be done with the path cost values... */ return pathnode; diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index aba4b88157..de14ddd2dc 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.126 2006/09/19 22:49:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.127 2006/10/04 00:29:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -78,9 +78,9 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, List *indexinfos = NIL; /* - * We need not lock the relation since it was already locked, either - * by the rewriter or when expand_inherited_rtentry() added it to the - * query's rangetable. + * We need not lock the relation since it was already locked, either by + * the rewriter or when expand_inherited_rtentry() added it to the query's + * rangetable. */ relation = heap_open(relationObjectId, NoLock); @@ -95,8 +95,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, /* * Estimate relation size --- unless it's an inheritance parent, in which - * case the size will be computed later in set_append_rel_pathlist, and - * we must leave it zero for now to avoid bollixing the total_table_pages + * case the size will be computed later in set_append_rel_pathlist, and we + * must leave it zero for now to avoid bollixing the total_table_pages * calculation. */ if (!inhparent) @@ -152,9 +152,9 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, /* * Ignore invalid indexes, since they can't safely be used for - * queries. Note that this is OK because the data structure - * we are constructing is only used by the planner --- the - * executor still needs to insert into "invalid" indexes! + * queries. Note that this is OK because the data structure we + * are constructing is only used by the planner --- the executor + * still needs to insert into "invalid" indexes! */ if (!index->indisvalid) { @@ -508,14 +508,14 @@ relation_excluded_by_constraints(RelOptInfo *rel, RangeTblEntry *rte) /* * We do not currently enforce that CHECK constraints contain only * immutable functions, so it's necessary to check here. We daren't draw - * conclusions from plan-time evaluation of non-immutable functions. - * Since they're ANDed, we can just ignore any mutable constraints in - * the list, and reason about the rest. + * conclusions from plan-time evaluation of non-immutable functions. Since + * they're ANDed, we can just ignore any mutable constraints in the list, + * and reason about the rest. */ safe_constraints = NIL; foreach(lc, constraint_pred) { - Node *pred = (Node *) lfirst(lc); + Node *pred = (Node *) lfirst(lc); if (!contain_mutable_functions(pred)) safe_constraints = lappend(safe_constraints, pred); @@ -526,9 +526,9 @@ relation_excluded_by_constraints(RelOptInfo *rel, RangeTblEntry *rte) * refute the entire collection at once. This may allow us to make proofs * that would fail if we took them individually. * - * Note: we use rel->baserestrictinfo, not safe_restrictions as might - * seem an obvious optimization. Some of the clauses might be OR clauses - * that have volatile and nonvolatile subclauses, and it's OK to make + * Note: we use rel->baserestrictinfo, not safe_restrictions as might seem + * an obvious optimization. Some of the clauses might be OR clauses that + * have volatile and nonvolatile subclauses, and it's OK to make * deductions with the nonvolatile parts. */ if (predicate_refuted_by(safe_constraints, rel->baserestrictinfo)) diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index b909e6d4bf..4a2609a4ab 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.9 2006/09/28 20:51:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.10 2006/10/04 00:29:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -208,6 +208,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_AND: + /* * AND-clause => AND-clause if A implies each of B's items */ @@ -224,6 +225,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) return result; case CLASS_OR: + /* * AND-clause => OR-clause if A implies any of B's items * @@ -241,6 +243,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) iterate_end(pred_info); if (result) return result; + /* * Also check if any of A's items implies B * @@ -258,6 +261,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) return result; case CLASS_ATOM: + /* * AND-clause => atom if any of A's items implies B */ @@ -279,6 +283,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_OR: + /* * OR-clause => OR-clause if each of A's items implies any * of B's items. Messy but can't do it any more simply. @@ -286,7 +291,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) result = true; iterate_begin(citem, clause, clause_info) { - bool presult = false; + bool presult = false; iterate_begin(pitem, predicate, pred_info) { @@ -308,6 +313,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) case CLASS_AND: case CLASS_ATOM: + /* * OR-clause => AND-clause if each of A's items implies B * @@ -331,6 +337,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_AND: + /* * atom => AND-clause if A implies each of B's items */ @@ -347,6 +354,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) return result; case CLASS_OR: + /* * atom => OR-clause if A implies any of B's items */ @@ -363,6 +371,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate) return result; case CLASS_ATOM: + /* * atom => atom is the base case */ @@ -427,6 +436,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_AND: + /* * AND-clause R=> AND-clause if A refutes any of B's items * @@ -444,6 +454,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) iterate_end(pred_info); if (result) return result; + /* * Also check if any of A's items refutes B * @@ -461,6 +472,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_OR: + /* * AND-clause R=> OR-clause if A refutes each of B's items */ @@ -477,6 +489,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_ATOM: + /* * If B is a NOT-clause, A R=> B if A => B's arg */ @@ -484,6 +497,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) if (not_arg && predicate_implied_by_recurse(clause, not_arg)) return true; + /* * AND-clause R=> atom if any of A's items refutes B */ @@ -505,6 +519,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_OR: + /* * OR-clause R=> OR-clause if A refutes each of B's items */ @@ -521,6 +536,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_AND: + /* * OR-clause R=> AND-clause if each of A's items refutes * any of B's items. @@ -528,7 +544,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) result = true; iterate_begin(citem, clause, clause_info) { - bool presult = false; + bool presult = false; iterate_begin(pitem, predicate, pred_info) { @@ -549,6 +565,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_ATOM: + /* * If B is a NOT-clause, A R=> B if A => B's arg */ @@ -556,6 +573,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) if (not_arg && predicate_implied_by_recurse(clause, not_arg)) return true; + /* * OR-clause R=> atom if each of A's items refutes B */ @@ -574,6 +592,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) break; case CLASS_ATOM: + /* * If A is a NOT-clause, A R=> B if B => A's arg */ @@ -584,6 +603,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) switch (pclass) { case CLASS_AND: + /* * atom R=> AND-clause if A refutes any of B's items */ @@ -600,6 +620,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_OR: + /* * atom R=> OR-clause if A refutes each of B's items */ @@ -616,6 +637,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) return result; case CLASS_ATOM: + /* * If B is a NOT-clause, A R=> B if A => B's arg */ @@ -623,6 +645,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate) if (not_arg && predicate_implied_by_recurse(clause, not_arg)) return true; + /* * atom R=> atom is the base case */ @@ -654,8 +677,8 @@ predicate_classify(Node *clause, PredIterInfo info) Assert(!IsA(clause, RestrictInfo)); /* - * If we see a List, assume it's an implicit-AND list; this is the - * correct semantics for lists of RestrictInfo nodes. + * If we see a List, assume it's an implicit-AND list; this is the correct + * semantics for lists of RestrictInfo nodes. */ if (IsA(clause, List)) { @@ -685,13 +708,13 @@ predicate_classify(Node *clause, PredIterInfo info) if (IsA(clause, ScalarArrayOpExpr)) { ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; - Node *arraynode = (Node *) lsecond(saop->args); + Node *arraynode = (Node *) lsecond(saop->args); /* - * We can break this down into an AND or OR structure, but only if - * we know how to iterate through expressions for the array's - * elements. We can do that if the array operand is a non-null - * constant or a simple ArrayExpr. + * We can break this down into an AND or OR structure, but only if we + * know how to iterate through expressions for the array's elements. + * We can do that if the array operand is a non-null constant or a + * simple ArrayExpr. */ if (arraynode && IsA(arraynode, Const) && !((Const *) arraynode)->constisnull) @@ -716,7 +739,7 @@ predicate_classify(Node *clause, PredIterInfo info) } /* - * PredIterInfo routines for iterating over regular Lists. The iteration + * PredIterInfo routines for iterating over regular Lists. The iteration * state variable is the next ListCell to visit. */ static void @@ -852,7 +875,7 @@ arrayexpr_startup_fn(Node *clause, PredIterInfo info) { ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause; ArrayExprIterState *state; - ArrayExpr *arrayexpr; + ArrayExpr *arrayexpr; /* Create working state struct */ state = (ArrayExprIterState *) palloc(sizeof(ArrayExprIterState)); diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 331855f8e9..4d5bffdb7b 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.82 2006/09/19 22:49:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.83 2006/10/04 00:29:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -97,9 +97,10 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind) case RTE_SUBQUERY: case RTE_FUNCTION: case RTE_VALUES: + /* - * Subquery, function, or values list --- set up attr range - * and arrays + * Subquery, function, or values list --- set up attr range and + * arrays * * Note: 0 is included in range to support whole-row Vars */ @@ -417,8 +418,8 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel, int ndx; /* - * We can't run into any child RowExprs here, but we could find - * a whole-row Var with a ConvertRowtypeExpr atop it. + * We can't run into any child RowExprs here, but we could find a + * whole-row Var with a ConvertRowtypeExpr atop it. */ var = origvar; while (!IsA(var, Var)) diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index ec43ee39f0..9176ae1680 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.48 2006/07/01 18:38:33 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.49 2006/10/04 00:29:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -169,14 +169,15 @@ make_restrictinfo_from_bitmapqual(Path *bitmapqual, */ return NIL; } + /* * If the sublist contains multiple RestrictInfos, we create an * AND subclause. If there's just one, we have to check if it's * an OR clause, and if so flatten it to preserve AND/OR flatness * of our output. * - * We construct lists with and without sub-RestrictInfos, so - * as not to have to regenerate duplicate RestrictInfos below. + * We construct lists with and without sub-RestrictInfos, so as + * not to have to regenerate duplicate RestrictInfos below. */ if (list_length(sublist) > 1) { @@ -186,7 +187,7 @@ make_restrictinfo_from_bitmapqual(Path *bitmapqual, } else { - RestrictInfo *subri = (RestrictInfo *) linitial(sublist); + RestrictInfo *subri = (RestrictInfo *) linitial(sublist); Assert(IsA(subri, RestrictInfo)); if (restriction_is_or_clause(subri)) |