diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-08-29 05:07:03 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-08-29 05:07:03 +0000 |
commit | b6b71b85bc45b49005b5aec87cba2c33fc8baf49 (patch) | |
tree | c23dbd1dbc43972a8e48327c8a771baf36952f3d /src/backend/optimizer/util | |
parent | 90cb9c305140684b2b00c739b724f67915e11404 (diff) | |
download | postgresql-b6b71b85bc45b49005b5aec87cba2c33fc8baf49.tar.gz postgresql-b6b71b85bc45b49005b5aec87cba2c33fc8baf49.zip |
Pgindent run for 8.0.
Diffstat (limited to 'src/backend/optimizer/util')
-rw-r--r-- | src/backend/optimizer/util/clauses.c | 78 | ||||
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 31 | ||||
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 16 | ||||
-rw-r--r-- | src/backend/optimizer/util/relnode.c | 8 | ||||
-rw-r--r-- | src/backend/optimizer/util/restrictinfo.c | 48 | ||||
-rw-r--r-- | src/backend/optimizer/util/tlist.c | 6 | ||||
-rw-r--r-- | src/backend/optimizer/util/var.c | 11 |
7 files changed, 98 insertions, 100 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index a2e2880941f..de0e7a539c2 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.179 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.180 2004/08/29 05:06:44 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -66,19 +66,19 @@ static bool contain_volatile_functions_walker(Node *node, void *context); static bool contain_nonstrict_functions_walker(Node *node, void *context); static bool set_coercionform_dontcare_walker(Node *node, void *context); static Node *eval_const_expressions_mutator(Node *node, - eval_const_expressions_context *context); + eval_const_expressions_context *context); static List *simplify_or_arguments(List *args, - bool *haveNull, bool *forceTrue); + bool *haveNull, bool *forceTrue); static List *simplify_and_arguments(List *args, - bool *haveNull, bool *forceFalse); + bool *haveNull, bool *forceFalse); static Expr *simplify_function(Oid funcid, Oid result_type, List *args, - bool allow_inline, - eval_const_expressions_context *context); + bool allow_inline, + eval_const_expressions_context *context); static Expr *evaluate_function(Oid funcid, Oid result_type, List *args, HeapTuple func_tuple); static Expr *inline_function(Oid funcid, Oid result_type, List *args, - HeapTuple func_tuple, - eval_const_expressions_context *context); + HeapTuple func_tuple, + eval_const_expressions_context *context); static Node *substitute_actual_parameters(Node *expr, int nargs, List *args, int *usecounts); static Node *substitute_actual_parameters_mutator(Node *node, @@ -717,7 +717,7 @@ contain_volatile_functions_walker(Node *node, void *context) * The idea here is that the caller has verified that the expression contains * one or more Var or Param nodes (as appropriate for the caller's need), and * now wishes to prove that the expression result will be NULL if any of these - * inputs is NULL. If we return false, then the proof succeeded. + * inputs is NULL. If we return false, then the proof succeeded. */ bool contain_nonstrict_functions(Node *clause) @@ -1164,11 +1164,11 @@ eval_const_expressions_mutator(Node *node, if (paramInfo) { /* - * Found it, so return a Const representing the param value. - * Note that we don't copy pass-by-ref datatypes, so the - * Const will only be valid as long as the bound parameter - * list exists. This is okay for intended uses of - * estimate_expression_value(). + * Found it, so return a Const representing the param + * value. Note that we don't copy pass-by-ref datatypes, + * so the Const will only be valid as long as the bound + * parameter list exists. This is okay for intended uses + * of estimate_expression_value(). */ int16 typLen; bool typByVal; @@ -1381,7 +1381,7 @@ eval_const_expressions_mutator(Node *node, bool forceTrue = false; newargs = simplify_or_arguments(args, - &haveNull, &forceTrue); + &haveNull, &forceTrue); if (forceTrue) return makeBoolConst(true, false); if (haveNull) @@ -1402,7 +1402,7 @@ eval_const_expressions_mutator(Node *node, bool forceFalse = false; newargs = simplify_and_arguments(args, - &haveNull, &forceFalse); + &haveNull, &forceFalse); if (forceFalse) return makeBoolConst(false, false); if (haveNull) @@ -1420,7 +1420,7 @@ eval_const_expressions_mutator(Node *node, Assert(list_length(args) == 1); if (IsA(linitial(args), Const)) { - Const *const_input = (Const *) linitial(args); + Const *const_input = (Const *) linitial(args); /* NOT NULL => NULL */ if (const_input->constisnull) @@ -1659,9 +1659,9 @@ eval_const_expressions_mutator(Node *node, * it can arise while simplifying functions.) Also, we can * optimize field selection from a RowExpr construct. * - * We must however check that the declared type of the field is - * still the same as when the FieldSelect was created --- this - * can change if someone did ALTER COLUMN TYPE on the rowtype. + * We must however check that the declared type of the field is still + * the same as when the FieldSelect was created --- this can + * change if someone did ALTER COLUMN TYPE on the rowtype. */ FieldSelect *fselect = (FieldSelect *) node; FieldSelect *newfselect; @@ -1684,13 +1684,13 @@ eval_const_expressions_mutator(Node *node, } if (arg && IsA(arg, RowExpr)) { - RowExpr *rowexpr = (RowExpr *) arg; + RowExpr *rowexpr = (RowExpr *) arg; if (fselect->fieldnum > 0 && fselect->fieldnum <= list_length(rowexpr->args)) { - Node *fld = (Node *) list_nth(rowexpr->args, - fselect->fieldnum - 1); + Node *fld = (Node *) list_nth(rowexpr->args, + fselect->fieldnum - 1); if (rowtype_field_matches(rowexpr->row_typeid, fselect->fieldnum, @@ -1746,17 +1746,18 @@ simplify_or_arguments(List *args, bool *haveNull, bool *forceTrue) foreach(larg, args) { - Node *arg = (Node *) lfirst(larg); + Node *arg = (Node *) lfirst(larg); if (IsA(arg, Const)) { - Const *const_input = (Const *) arg; + Const *const_input = (Const *) arg; if (const_input->constisnull) *haveNull = true; else if (DatumGetBool(const_input->constvalue)) { *forceTrue = true; + /* * Once we detect a TRUE result we can just exit the loop * immediately. However, if we ever add a notion of @@ -1769,13 +1770,11 @@ simplify_or_arguments(List *args, bool *haveNull, bool *forceTrue) else if (or_clause(arg)) { newargs = list_concat(newargs, - simplify_or_arguments(((BoolExpr *) arg)->args, - haveNull, forceTrue)); + simplify_or_arguments(((BoolExpr *) arg)->args, + haveNull, forceTrue)); } else - { newargs = lappend(newargs, arg); - } } return newargs; @@ -1807,17 +1806,18 @@ simplify_and_arguments(List *args, bool *haveNull, bool *forceFalse) foreach(larg, args) { - Node *arg = (Node *) lfirst(larg); + Node *arg = (Node *) lfirst(larg); if (IsA(arg, Const)) { - Const *const_input = (Const *) arg; + Const *const_input = (Const *) arg; if (const_input->constisnull) *haveNull = true; else if (!DatumGetBool(const_input->constvalue)) { *forceFalse = true; + /* * Once we detect a FALSE result we can just exit the loop * immediately. However, if we ever add a notion of @@ -1830,13 +1830,11 @@ simplify_and_arguments(List *args, bool *haveNull, bool *forceFalse) else if (and_clause(arg)) { newargs = list_concat(newargs, - simplify_and_arguments(((BoolExpr *) arg)->args, - haveNull, forceFalse)); + simplify_and_arguments(((BoolExpr *) arg)->args, + haveNull, forceFalse)); } else - { newargs = lappend(newargs, arg); - } } return newargs; @@ -2272,7 +2270,7 @@ substitute_actual_parameters_mutator(Node *node, static void sql_inline_error_callback(void *arg) { - HeapTuple func_tuple = (HeapTuple) arg; + HeapTuple func_tuple = (HeapTuple) arg; Form_pg_proc funcform = (Form_pg_proc) GETSTRUCT(func_tuple); int syntaxerrposition; @@ -2586,7 +2584,7 @@ expression_tree_walker(Node *node, return walker(((FieldSelect *) node)->arg, context); case T_FieldStore: { - FieldStore *fstore = (FieldStore *) node; + FieldStore *fstore = (FieldStore *) node; if (walker(fstore->arg, context)) return true; @@ -3041,8 +3039,8 @@ expression_tree_mutator(Node *node, break; case T_RowExpr: { - RowExpr *rowexpr = (RowExpr *) node; - RowExpr *newnode; + RowExpr *rowexpr = (RowExpr *) node; + RowExpr *newnode; FLATCOPY(newnode, rowexpr, RowExpr); MUTATE(newnode->args, rowexpr->args, List *); @@ -3259,9 +3257,7 @@ query_tree_mutator(Query *query, break; case RTE_JOIN: if (!(flags & QTW_IGNORE_JOINALIASES)) - { MUTATE(newrte->joinaliasvars, rte->joinaliasvars, List *); - } break; case RTE_FUNCTION: MUTATE(newrte->funcexpr, rte->funcexpr, Node *); diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 170b964a481..bb001594177 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.109 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.110 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -100,8 +100,9 @@ compare_fuzzy_path_costs(Path *path1, Path *path2, CostSelector criterion) Cost fuzz; /* - * The fuzz factor is set at one percent of the smaller total_cost, but - * not less than 0.01 cost units (just in case total cost is zero). + * The fuzz factor is set at one percent of the smaller total_cost, + * but not less than 0.01 cost units (just in case total cost is + * zero). * * XXX does this percentage need to be user-configurable? */ @@ -278,7 +279,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path) * possible for more than one old path to be tossed out because * new_path dominates it. */ - p1 = list_head(parent_rel->pathlist); /* cannot use foreach here */ + p1 = list_head(parent_rel->pathlist); /* cannot use foreach here */ while (p1 != NULL) { Path *old_path = (Path *) lfirst(p1); @@ -286,9 +287,9 @@ add_path(RelOptInfo *parent_rel, Path *new_path) int costcmp; /* - * As of Postgres 8.0, we use fuzzy cost comparison to avoid wasting - * cycles keeping paths that are really not significantly different - * in cost. + * As of Postgres 8.0, we use fuzzy cost comparison to avoid + * wasting cycles keeping paths that are really not significantly + * different in cost. */ costcmp = compare_fuzzy_path_costs(new_path, old_path, TOTAL_COST); @@ -298,8 +299,8 @@ add_path(RelOptInfo *parent_rel, Path *new_path) * slower) comparison of pathkeys. If they compare the same, * proceed with the pathkeys comparison. Note: this test relies * on the fact that compare_fuzzy_path_costs will only return 0 if - * both costs are effectively equal (and, therefore, there's no need - * to call it twice in that case). + * both costs are effectively equal (and, therefore, there's no + * need to call it twice in that case). */ if (costcmp == 0 || costcmp == compare_fuzzy_path_costs(new_path, old_path, @@ -321,9 +322,9 @@ add_path(RelOptInfo *parent_rel, Path *new_path) */ if (compare_path_costs(new_path, old_path, TOTAL_COST) < 0) - remove_old = true; /* new dominates old */ + remove_old = true; /* new dominates old */ else - accept_new = false; /* old equals or dominates + accept_new = false; /* old equals or dominates * new */ } break; @@ -521,7 +522,7 @@ create_append_path(RelOptInfo *rel, List *subpaths) { Path *subpath = (Path *) lfirst(l); - if (l == list_head(subpaths)) /* first node? */ + if (l == list_head(subpaths)) /* first node? */ pathnode->path.startup_cost = subpath->startup_cost; pathnode->path.total_cost += subpath->total_cost; } @@ -641,8 +642,8 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath) pathnode->subpath = subpath; /* - * If the input is a subquery whose output must be unique already, - * we don't need to do anything. + * If the input is a subquery whose output must be unique already, we + * don't need to do anything. */ if (rel->rtekind == RTE_SUBQUERY) { @@ -777,7 +778,7 @@ is_distinct_query(Query *query) /* * GROUP BY guarantees uniqueness if all the grouped columns appear in - * the output. In our implementation this means checking they are non + * the output. In our implementation this means checking they are non * resjunk columns. */ if (query->groupClause) diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 6c20b6c0489..ba58251919b 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.95 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.96 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -146,7 +146,7 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel) ChangeVarNodes((Node *) info->indexprs, 1, varno, 0); if (info->indpred && varno != 1) ChangeVarNodes((Node *) info->indpred, 1, varno, 0); - info->predOK = false; /* set later in indxpath.c */ + info->predOK = false; /* set later in indxpath.c */ info->unique = index->indisunique; /* initialize cached join info to empty */ @@ -214,12 +214,12 @@ build_physical_tlist(Query *root, RelOptInfo *rel) } tlist = lappend(tlist, - create_tl_element(makeVar(varno, - attrno, - att_tup->atttypid, - att_tup->atttypmod, - 0), - attrno)); + create_tl_element(makeVar(varno, + attrno, + att_tup->atttypid, + att_tup->atttypmod, + 0), + attrno)); } heap_close(relation, AccessShareLock); diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 7ae08a64896..bdef23fc26c 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.61 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.62 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -450,9 +450,9 @@ build_joinrel_restrictlist(Query *root, * Collect all the clauses that syntactically belong at this level. */ rlist = list_concat(subbuild_joinrel_restrictlist(joinrel, - outer_rel->joininfo), + outer_rel->joininfo), subbuild_joinrel_restrictlist(joinrel, - inner_rel->joininfo)); + inner_rel->joininfo)); /* * Eliminate duplicate and redundant clauses. @@ -500,7 +500,7 @@ subbuild_joinrel_restrictlist(RelOptInfo *joinrel, * but we can use a shallow copy. */ restrictlist = list_concat(restrictlist, - list_copy(joininfo->jinfo_restrictinfo)); + list_copy(joininfo->jinfo_restrictinfo)); } else { diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index bfdd659c6ba..c225668cbb5 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.29 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.30 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,12 +22,12 @@ static RestrictInfo *make_restrictinfo_internal(Expr *clause, - Expr *orclause, - bool is_pushed_down, - bool valid_everywhere); + Expr *orclause, + bool is_pushed_down, + bool valid_everywhere); static Expr *make_sub_restrictinfos(Expr *clause, - bool is_pushed_down, - bool valid_everywhere); + bool is_pushed_down, + bool valid_everywhere); static RestrictInfo *join_clause_is_redundant(Query *root, RestrictInfo *rinfo, List *reference_list, @@ -104,7 +104,7 @@ make_restrictinfo_from_indexclauses(List *indexclauses, /* Else we need an OR RestrictInfo structure */ foreach(orlist, indexclauses) { - List *andlist = (List *) lfirst(orlist); + List *andlist = (List *) lfirst(orlist); /* Create AND subclause with RestrictInfos */ withris = lappend(withris, make_ands_explicit(andlist)); @@ -113,9 +113,9 @@ make_restrictinfo_from_indexclauses(List *indexclauses, withoutris = lappend(withoutris, make_ands_explicit(andlist)); } return list_make1(make_restrictinfo_internal(make_orclause(withoutris), - make_orclause(withris), - is_pushed_down, - valid_everywhere)); + make_orclause(withris), + is_pushed_down, + valid_everywhere)); } /* @@ -136,8 +136,8 @@ make_restrictinfo_internal(Expr *clause, Expr *orclause, restrictinfo->can_join = false; /* may get set below */ /* - * If it's a binary opclause, set up left/right relids info. - * In any case set up the total clause relids info. + * If it's a binary opclause, set up left/right relids info. In any + * case set up the total clause relids info. */ if (is_opclause(clause) && list_length(((OpExpr *) clause)->args) == 2) { @@ -145,12 +145,12 @@ make_restrictinfo_internal(Expr *clause, Expr *orclause, restrictinfo->right_relids = pull_varnos(get_rightop(clause)); restrictinfo->clause_relids = bms_union(restrictinfo->left_relids, - restrictinfo->right_relids); + restrictinfo->right_relids); /* * Does it look like a normal join clause, i.e., a binary operator * relating expressions that come from distinct relations? If so - * we might be able to use it in a join algorithm. Note that this + * we might be able to use it in a join algorithm. Note that this * is a purely syntactic test that is made regardless of context. */ if (!bms_is_empty(restrictinfo->left_relids) && @@ -169,10 +169,10 @@ make_restrictinfo_internal(Expr *clause, Expr *orclause, } /* - * Fill in all the cacheable fields with "not yet set" markers. - * None of these will be computed until/unless needed. Note in - * particular that we don't mark a binary opclause as mergejoinable - * or hashjoinable here; that happens only if it appears in the right + * Fill in all the cacheable fields with "not yet set" markers. None + * of these will be computed until/unless needed. Note in particular + * that we don't mark a binary opclause as mergejoinable or + * hashjoinable here; that happens only if it appears in the right * context (top level of a joinclause list). */ restrictinfo->eval_cost.startup = -1; @@ -322,16 +322,16 @@ remove_redundant_join_clauses(Query *root, List *restrictinfo_list, /* * If there are any redundant clauses, we want to eliminate the ones - * that are more expensive in favor of the ones that are less so. - * Run cost_qual_eval() to ensure the eval_cost fields are set up. + * that are more expensive in favor of the ones that are less so. Run + * cost_qual_eval() to ensure the eval_cost fields are set up. */ cost_qual_eval(&cost, restrictinfo_list); /* - * We don't have enough knowledge yet to be able to estimate the number - * of times a clause might be evaluated, so it's hard to weight the - * startup and per-tuple costs appropriately. For now just weight 'em - * the same. + * We don't have enough knowledge yet to be able to estimate the + * number of times a clause might be evaluated, so it's hard to weight + * the startup and per-tuple costs appropriately. For now just weight + * 'em the same. */ #define CLAUSECOST(r) ((r)->eval_cost.startup + (r)->eval_cost.per_tuple) diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c index 121636c456c..1c1089ee9d7 100644 --- a/src/backend/optimizer/util/tlist.c +++ b/src/backend/optimizer/util/tlist.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.66 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.67 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -90,8 +90,8 @@ tlist_member(Node *node, List *targetlist) TargetEntry * create_tl_element(Var *var, int resdomno) { - Oid vartype; - int32 vartypmod; + Oid vartype; + int32 vartypmod; if (IsA(var, Var)) { diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c index 6bba4bfa27c..ef48dfbcd54 100644 --- a/src/backend/optimizer/util/var.c +++ b/src/backend/optimizer/util/var.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.61 2004/08/29 04:12:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.62 2004/08/29 05:06:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -473,7 +473,7 @@ pull_var_clause_walker(Node *node, pull_var_clause_context *context) * flatten_join_alias_vars * Replace Vars that reference JOIN outputs with references to the original * relation variables instead. This allows quals involving such vars to be - * pushed down. Whole-row Vars that reference JOIN relations are expanded + * pushed down. Whole-row Vars that reference JOIN relations are expanded * into RowExpr constructs that name the individual output Vars. This * is necessary since we will not scan the JOIN as a base relation, which * is the only way that the executor can directly handle whole-row Vars. @@ -513,10 +513,10 @@ flatten_join_alias_vars_mutator(Node *node, if (var->varattno == InvalidAttrNumber) { /* Must expand whole-row reference */ - RowExpr *rowexpr; - List *fields = NIL; + RowExpr *rowexpr; + List *fields = NIL; AttrNumber attnum; - ListCell *l; + ListCell *l; attnum = 0; foreach(l, rte->joinaliasvars) @@ -528,6 +528,7 @@ flatten_join_alias_vars_mutator(Node *node, var->varno, attnum)) continue; + /* * If we are expanding an alias carried down from an upper * query, must adjust its varlevelsup fields. |