mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
New pgindent run with fixes suggested by Tom. Patch manually reviewed,
initdb/regression tests pass.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.13 2001/10/30 05:38:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/_deadcode/Attic/predmig.c,v 1.14 2001/11/05 17:46:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ static int xfunc_stream_compare(void *arg1, void *arg2);
|
||||
static bool xfunc_check_stream(Stream node);
|
||||
static bool xfunc_in_stream(Stream node, Stream stream);
|
||||
|
||||
/* ----------------- MAIN FUNCTIONS ------------------------ */
|
||||
/* ----------------- MAIN FUNCTIONS ------------------------ */
|
||||
/*
|
||||
** xfunc_do_predmig
|
||||
** wrapper for Predicate Migration. It calls xfunc_predmig until no
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.81 2001/10/28 06:25:44 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.82 2001/11/05 17:46:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -669,4 +669,4 @@ debug_print_rel(Query *root, RelOptInfo *rel)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#endif /* OPTIMIZER_DEBUG */
|
||||
#endif /* OPTIMIZER_DEBUG */
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.47 2001/10/25 05:49:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.48 2001/11/05 17:46:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -520,7 +520,7 @@ clause_selectivity(Query *root,
|
||||
|
||||
#ifdef SELECTIVITY_DEBUG
|
||||
elog(NOTICE, "clause_selectivity: s1 %f", s1);
|
||||
#endif /* SELECTIVITY_DEBUG */
|
||||
#endif /* SELECTIVITY_DEBUG */
|
||||
|
||||
return s1;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.112 2001/10/30 19:58:58 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.113 2001/11/05 17:46:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -176,7 +176,7 @@ subquery_planner(Query *parse, double tuple_fraction)
|
||||
/*
|
||||
* Check for ungrouped variables passed to subplans in targetlist and
|
||||
* HAVING clause (but not in WHERE or JOIN/ON clauses, since those are
|
||||
* evaluated before grouping). We can't do this any earlier because
|
||||
* evaluated before grouping). We can't do this any earlier because
|
||||
* we must use the preprocessed targetlist for comparisons of grouped
|
||||
* expressions.
|
||||
*/
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.72 2001/10/30 19:58:58 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.73 2001/11/05 17:46:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -309,7 +309,7 @@ set_uppernode_references(Plan *plan, Index subvarno)
|
||||
{
|
||||
TargetEntry *tle = (TargetEntry *) lfirst(l);
|
||||
|
||||
if (tle->expr && ! IsA(tle->expr, Var))
|
||||
if (tle->expr && !IsA(tle->expr, Var))
|
||||
{
|
||||
tlist_has_non_vars = true;
|
||||
break;
|
||||
@@ -327,7 +327,7 @@ set_uppernode_references(Plan *plan, Index subvarno)
|
||||
subplan_targetlist,
|
||||
tlist_has_non_vars);
|
||||
output_targetlist = lappend(output_targetlist,
|
||||
makeTargetEntry(tle->resdom, newexpr));
|
||||
makeTargetEntry(tle->resdom, newexpr));
|
||||
}
|
||||
plan->targetlist = output_targetlist;
|
||||
|
||||
@@ -493,7 +493,7 @@ replace_vars_with_subplan_refs_mutator(Node *node,
|
||||
resdom->restype,
|
||||
resdom->restypmod,
|
||||
0);
|
||||
newvar->varnoold = 0; /* wasn't ever a plain Var */
|
||||
newvar->varnoold = 0; /* wasn't ever a plain Var */
|
||||
newvar->varoattno = 0;
|
||||
return (Node *) newvar;
|
||||
}
|
||||
|
@@ -217,4 +217,4 @@ inspectOpNode(Expr *expr)
|
||||
return (firstExpr && secondExpr && nodeTag(firstExpr) == T_Var && nodeTag(secondExpr) == T_Const);
|
||||
}
|
||||
|
||||
#endif /* ENABLE_KEY_SET_QUERY */
|
||||
#endif /* ENABLE_KEY_SET_QUERY */
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.45 2001/11/02 20:23:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.46 2001/11/05 17:46:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -202,7 +202,7 @@ expand_targetlist(List *tlist, int command_type,
|
||||
if (COLUMN_IS_DROPPED(att_tup))
|
||||
new_expr = (Node *) makeNullConst(atttype);
|
||||
else
|
||||
#endif /* _DROP_COLUMN_HACK__ */
|
||||
#endif /* _DROP_COLUMN_HACK__ */
|
||||
new_expr = (Node *) makeVar(result_relation,
|
||||
attrno,
|
||||
atttype,
|
||||
@@ -211,7 +211,7 @@ expand_targetlist(List *tlist, int command_type,
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "expand_targetlist: unexpected command_type");
|
||||
new_expr = NULL; /* keep compiler quiet */
|
||||
new_expr = NULL; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ build_column_default(Relation rel, int attrno)
|
||||
{
|
||||
if (attrno == defval[ndef].adnum)
|
||||
{
|
||||
Oid type_id;
|
||||
Oid type_id;
|
||||
|
||||
/*
|
||||
* Found it, convert string representation to node tree.
|
||||
@@ -381,10 +381,11 @@ build_column_default(Relation rel, int attrno)
|
||||
expr = stringToNode(defval[ndef].adbin);
|
||||
|
||||
/*
|
||||
* Make sure the value is coerced to the target column type
|
||||
* (might not be right type yet if it's not a constant!)
|
||||
* This should match the parser's processing of non-defaulted
|
||||
* expressions --- see updateTargetListEntry().
|
||||
* Make sure the value is coerced to the target column
|
||||
* type (might not be right type yet if it's not a
|
||||
* constant!) This should match the parser's processing of
|
||||
* non-defaulted expressions --- see
|
||||
* updateTargetListEntry().
|
||||
*/
|
||||
type_id = exprType(expr);
|
||||
|
||||
@@ -392,6 +393,7 @@ build_column_default(Relation rel, int attrno)
|
||||
{
|
||||
expr = CoerceTargetExpr(NULL, expr, type_id,
|
||||
atttype, atttypmod);
|
||||
|
||||
/*
|
||||
* This really shouldn't fail; should have checked the
|
||||
* default's type when it was created ...
|
||||
@@ -418,13 +420,15 @@ build_column_default(Relation rel, int attrno)
|
||||
|
||||
/*
|
||||
* No per-column default, so look for a default for the type itself.
|
||||
* If there isn't one, we generate a NULL constant of the correct type.
|
||||
* If there isn't one, we generate a NULL constant of the correct
|
||||
* type.
|
||||
*/
|
||||
if (att_tup->attisset)
|
||||
{
|
||||
/*
|
||||
* Set attributes are represented as OIDs no matter what the set
|
||||
* element type is, and the element type's default is irrelevant too.
|
||||
* element type is, and the element type's default is irrelevant
|
||||
* too.
|
||||
*/
|
||||
hasdefault = false;
|
||||
typedefault = (Datum) 0;
|
||||
@@ -440,7 +444,7 @@ build_column_default(Relation rel, int attrno)
|
||||
typedefault = (Datum) 0;
|
||||
}
|
||||
else
|
||||
#endif /* _DROP_COLUMN_HACK__ */
|
||||
#endif /* _DROP_COLUMN_HACK__ */
|
||||
hasdefault = get_typdefault(atttype, &typedefault);
|
||||
|
||||
get_typlenbyval(atttype, &typlen, &typbyval);
|
||||
@@ -451,12 +455,12 @@ build_column_default(Relation rel, int attrno)
|
||||
typedefault,
|
||||
!hasdefault,
|
||||
typbyval,
|
||||
false, /* not a set */
|
||||
false, /* not a set */
|
||||
false);
|
||||
|
||||
/*
|
||||
* If the column is a fixed-length type, it may need a length coercion
|
||||
* as well as a type coercion. But NULLs don't need that.
|
||||
* as well as a type coercion. But NULLs don't need that.
|
||||
*/
|
||||
if (hasdefault)
|
||||
expr = coerce_type_typmod(NULL, expr,
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.90 2001/10/30 19:58:58 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.91 2001/11/05 17:46:26 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -43,14 +43,14 @@ typedef struct
|
||||
{
|
||||
Query *query;
|
||||
List *groupClauses;
|
||||
} check_subplans_for_ungrouped_vars_context;
|
||||
} check_subplans_for_ungrouped_vars_context;
|
||||
|
||||
static bool contain_agg_clause_walker(Node *node, void *context);
|
||||
static bool pull_agg_clause_walker(Node *node, List **listptr);
|
||||
static bool contain_subplans_walker(Node *node, void *context);
|
||||
static bool pull_subplans_walker(Node *node, List **listptr);
|
||||
static bool check_subplans_for_ungrouped_vars_walker(Node *node,
|
||||
check_subplans_for_ungrouped_vars_context *context);
|
||||
check_subplans_for_ungrouped_vars_context * context);
|
||||
static bool contain_noncachable_functions_walker(Node *node, void *context);
|
||||
static Node *eval_const_expressions_mutator(Node *node, void *context);
|
||||
static Expr *simplify_op_or_func(Expr *expr, List *args);
|
||||
@@ -525,7 +525,7 @@ pull_subplans_walker(Node *node, List **listptr)
|
||||
*
|
||||
* A deficiency in this scheme is that any outer reference var must be
|
||||
* grouped by itself; we don't recognize groupable expressions within
|
||||
* subselects. For example, consider
|
||||
* subselects. For example, consider
|
||||
* SELECT
|
||||
* (SELECT x FROM bar where y = (foo.a + foo.b))
|
||||
* FROM foo
|
||||
@@ -536,12 +536,13 @@ void
|
||||
check_subplans_for_ungrouped_vars(Query *query)
|
||||
{
|
||||
check_subplans_for_ungrouped_vars_context context;
|
||||
List *gl;
|
||||
List *gl;
|
||||
|
||||
context.query = query;
|
||||
|
||||
/*
|
||||
* Build a list of the acceptable GROUP BY expressions for use in
|
||||
* the walker (to avoid repeated scans of the targetlist within the
|
||||
* Build a list of the acceptable GROUP BY expressions for use in the
|
||||
* walker (to avoid repeated scans of the targetlist within the
|
||||
* recursive routine).
|
||||
*/
|
||||
context.groupClauses = NIL;
|
||||
@@ -555,9 +556,9 @@ check_subplans_for_ungrouped_vars(Query *query)
|
||||
}
|
||||
|
||||
/*
|
||||
* Recursively scan the targetlist and the HAVING clause.
|
||||
* WHERE and JOIN/ON conditions are not examined, since they are
|
||||
* evaluated before grouping.
|
||||
* Recursively scan the targetlist and the HAVING clause. WHERE and
|
||||
* JOIN/ON conditions are not examined, since they are evaluated
|
||||
* before grouping.
|
||||
*/
|
||||
check_subplans_for_ungrouped_vars_walker((Node *) query->targetList,
|
||||
&context);
|
||||
@@ -569,13 +570,13 @@ check_subplans_for_ungrouped_vars(Query *query)
|
||||
|
||||
static bool
|
||||
check_subplans_for_ungrouped_vars_walker(Node *node,
|
||||
check_subplans_for_ungrouped_vars_context *context)
|
||||
check_subplans_for_ungrouped_vars_context * context)
|
||||
{
|
||||
List *gl;
|
||||
|
||||
if (node == NULL)
|
||||
return false;
|
||||
if (IsA(node, Const) || IsA(node, Param))
|
||||
if (IsA(node, Const) ||IsA(node, Param))
|
||||
return false; /* constants are always acceptable */
|
||||
|
||||
/*
|
||||
@@ -648,7 +649,7 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
|
||||
char *attname;
|
||||
|
||||
Assert(var->varno > 0 &&
|
||||
(int) var->varno <= length(context->query->rtable));
|
||||
(int) var->varno <= length(context->query->rtable));
|
||||
rte = rt_fetch(var->varno, context->query->rtable);
|
||||
attname = get_rte_attribute_name(rte, var->varattno);
|
||||
elog(ERROR, "Sub-SELECT uses un-GROUPed attribute %s.%s from outer query",
|
||||
|
Reference in New Issue
Block a user