1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

pgindent run before PG 9.1 beta 1.

This commit is contained in:
Bruce Momjian
2011-04-10 11:42:00 -04:00
parent 9a8b73147c
commit bf50caf105
446 changed files with 5737 additions and 5258 deletions

View File

@ -759,8 +759,8 @@ transformInsertRow(ParseState *pstate, List *exprlist,
* columns. Add a suitable hint if that seems to be the problem,
* because the main error message is quite misleading for this case.
* (If there's no stmtcols, you'll get something about data type
* mismatch, which is less misleading so we don't worry about giving
* a hint in that case.)
* mismatch, which is less misleading so we don't worry about giving a
* hint in that case.)
*/
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
@ -809,7 +809,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
* return -1 if expression isn't a RowExpr or a Var referencing one.
*
* This is currently used only for hint purposes, so we aren't terribly
* tense about recognizing all possible cases. The Var case is interesting
* tense about recognizing all possible cases. The Var case is interesting
* because that's what we'll get in the INSERT ... SELECT (...) case.
*/
static int
@ -1100,8 +1100,8 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
/*
* We must assign collations now because assign_query_collations
* doesn't process rangetable entries. We just assign all the
* collations independently in each row, and don't worry about
* whether they are consistent vertically either.
* collations independently in each row, and don't worry about whether
* they are consistent vertically either.
*/
assign_list_collations(pstate, newsublist);
@ -1452,7 +1452,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
* Recursively transform leaves and internal nodes of a set-op tree
*
* In addition to returning the transformed node, if targetlist isn't NULL
* then we return a list of its non-resjunk TargetEntry nodes. For a leaf
* then we return a list of its non-resjunk TargetEntry nodes. For a leaf
* set-op node these are the actual targetlist entries; otherwise they are
* dummy entries created to carry the type, typmod, collation, and location
* (for error messages) of each output column of the set-op node. This info
@ -1672,7 +1672,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
* child query's semantics.
*
* If a child expression is an UNKNOWN-type Const or Param, we
* want to replace it with the coerced expression. This can only
* want to replace it with the coerced expression. This can only
* happen when the child is a leaf set-op node. It's safe to
* replace the expression because if the child query's semantics
* depended on the type of this output column, it'd have already
@ -1721,8 +1721,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
* collation.)
*/
rescolcoll = select_common_collation(pstate,
list_make2(lcolnode, rcolnode),
(op->op == SETOP_UNION && op->all));
list_make2(lcolnode, rcolnode),
(op->op == SETOP_UNION && op->all));
/* emit results */
op->colTypes = lappend_oid(op->colTypes, rescoltype);
@ -1778,7 +1778,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
rescolnode->collation = rescolcoll;
rescolnode->location = bestlocation;
restle = makeTargetEntry((Expr *) rescolnode,
0, /* no need to set resno */
0, /* no need to set resno */
NULL,
false);
*targetlist = lappend(*targetlist, restle);
@ -2331,10 +2331,10 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc,
case RTE_RELATION:
if (rte->relkind == RELKIND_FOREIGN_TABLE)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be used with foreign table \"%s\"",
rte->eref->aliasname),
parser_errposition(pstate, thisrel->location)));
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be used with foreign table \"%s\"",
rte->eref->aliasname),
parser_errposition(pstate, thisrel->location)));
applyLockingClause(qry, i,
lc->forUpdate, lc->noWait,
pushedDown);

View File

@ -631,7 +631,7 @@ check_ungrouped_columns_walker(Node *node,
/*
* Check whether the Var is known functionally dependent on the GROUP
* BY columns. If so, we can allow the Var to be used, because the
* BY columns. If so, we can allow the Var to be used, because the
* grouping is really a no-op for this table. However, this deduction
* depends on one or more constraints of the table, so we have to add
* those constraints to the query's constraintDeps list, because it's
@ -642,11 +642,11 @@ check_ungrouped_columns_walker(Node *node,
* Because this is a pretty expensive check, and will have the same
* outcome for all columns of a table, we remember which RTEs we've
* already proven functional dependency for in the func_grouped_rels
* list. This test also prevents us from adding duplicate entries
* to the constraintDeps list.
* list. This test also prevents us from adding duplicate entries to
* the constraintDeps list.
*/
if (list_member_int(*context->func_grouped_rels, var->varno))
return false; /* previously proven acceptable */
return false; /* previously proven acceptable */
Assert(var->varno > 0 &&
(int) var->varno <= list_length(context->pstate->p_rtable));
@ -661,7 +661,7 @@ check_ungrouped_columns_walker(Node *node,
{
*context->func_grouped_rels =
lappend_int(*context->func_grouped_rels, var->varno);
return false; /* acceptable */
return false; /* acceptable */
}
}

View File

@ -1078,7 +1078,7 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
else if (l_colvar->vartypmod != outcoltypmod)
l_node = (Node *) makeRelabelType((Expr *) l_colvar,
outcoltype, outcoltypmod,
InvalidOid, /* fixed below */
InvalidOid, /* fixed below */
COERCE_IMPLICIT_CAST);
else
l_node = (Node *) l_colvar;
@ -1090,7 +1090,7 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
else if (r_colvar->vartypmod != outcoltypmod)
r_node = (Node *) makeRelabelType((Expr *) r_colvar,
outcoltype, outcoltypmod,
InvalidOid, /* fixed below */
InvalidOid, /* fixed below */
COERCE_IMPLICIT_CAST);
else
r_node = (Node *) r_colvar;
@ -1143,8 +1143,8 @@ buildMergedJoinVar(ParseState *pstate, JoinType jointype,
/*
* Apply assign_expr_collations to fix up the collation info in the
* coercion and CoalesceExpr nodes, if we made any. This must be done
* now so that the join node's alias vars show correct collation info.
* coercion and CoalesceExpr nodes, if we made any. This must be done now
* so that the join node's alias vars show correct collation info.
*/
assign_expr_collations(pstate, res_node);

View File

@ -285,7 +285,7 @@ coerce_type(ParseState *pstate, Node *node,
{
/*
* If we have a COLLATE clause, we have to push the coercion
* underneath the COLLATE. This is really ugly, but there is little
* underneath the COLLATE. This is really ugly, but there is little
* choice because the above hacks on Consts and Params wouldn't happen
* otherwise.
*/
@ -1959,7 +1959,7 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
Oid sourceElem;
if ((targetElem = get_element_type(targetTypeId)) != InvalidOid &&
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
{
CoercionPathType elempathtype;
Oid elemfuncid;
@ -2091,8 +2091,8 @@ is_complex_array(Oid typid)
static bool
typeIsOfTypedTable(Oid reltypeId, Oid reloftypeId)
{
Oid relid = typeidTypeRelid(reltypeId);
bool result = false;
Oid relid = typeidTypeRelid(reltypeId);
bool result = false;
if (relid)
{

View File

@ -14,19 +14,19 @@
* 1. The output collation of each expression node, or InvalidOid if it
* returns a noncollatable data type. This can also be InvalidOid if the
* result type is collatable but the collation is indeterminate.
* 2. The collation to be used in executing each function. InvalidOid means
* 2. The collation to be used in executing each function. InvalidOid means
* that there are no collatable inputs or their collation is indeterminate.
* This value is only stored in node types that might call collation-using
* functions.
*
* You might think we could get away with storing only one collation per
* node, but the two concepts really need to be kept distinct. Otherwise
* node, but the two concepts really need to be kept distinct. Otherwise
* it's too confusing when a function produces a collatable output type but
* has no collatable inputs or produces noncollatable output from collatable
* inputs.
*
* Cases with indeterminate collation might result in an error being thrown
* at runtime. If we knew exactly which functions require collation
* at runtime. If we knew exactly which functions require collation
* information, we could throw those errors at parse time instead.
*
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
@ -72,7 +72,7 @@ typedef struct
static bool assign_query_collations_walker(Node *node, ParseState *pstate);
static bool assign_collations_walker(Node *node,
assign_collations_context *context);
assign_collations_context *context);
/*
@ -116,8 +116,8 @@ assign_query_collations_walker(Node *node, ParseState *pstate)
return false;
/*
* We don't want to recurse into a set-operations tree; it's already
* been fully processed in transformSetOperationStmt.
* We don't want to recurse into a set-operations tree; it's already been
* fully processed in transformSetOperationStmt.
*/
if (IsA(node, SetOperationStmt))
return false;
@ -144,7 +144,7 @@ assign_list_collations(ParseState *pstate, List *exprs)
foreach(lc, exprs)
{
Node *node = (Node *) lfirst(lc);
Node *node = (Node *) lfirst(lc);
assign_expr_collations(pstate, node);
}
@ -231,7 +231,7 @@ select_common_collation(ParseState *pstate, List *exprs, bool none_ok)
* Recursive guts of collation processing.
*
* Nodes with no children (eg, Vars, Consts, Params) must have been marked
* when built. All upper-level nodes are marked here.
* when built. All upper-level nodes are marked here.
*
* Note: if this is invoked directly on a List, it will attempt to infer a
* common collation for all the list members. In particular, it will throw
@ -250,9 +250,9 @@ assign_collations_walker(Node *node, assign_collations_context *context)
return false;
/*
* Prepare for recursion. For most node types, though not all, the
* first thing we do is recurse to process all nodes below this one.
* Each level of the tree has its own local context.
* Prepare for recursion. For most node types, though not all, the first
* thing we do is recurse to process all nodes below this one. Each level
* of the tree has its own local context.
*/
loccontext.pstate = context->pstate;
loccontext.collation = InvalidOid;
@ -323,11 +323,11 @@ assign_collations_walker(Node *node, assign_collations_context *context)
{
/*
* CaseExpr is a special case because we do not want to
* recurse into the test expression (if any). It was
* already marked with collations during transformCaseExpr,
* and furthermore its collation is not relevant to the
* result of the CASE --- only the output expressions are.
* So we can't use expression_tree_walker here.
* recurse into the test expression (if any). It was already
* marked with collations during transformCaseExpr, and
* furthermore its collation is not relevant to the result of
* the CASE --- only the output expressions are. So we can't
* use expression_tree_walker here.
*/
CaseExpr *expr = (CaseExpr *) node;
Oid typcollation;
@ -338,6 +338,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
CaseWhen *when = (CaseWhen *) lfirst(lc);
Assert(IsA(when, CaseWhen));
/*
* The condition expressions mustn't affect the CASE's
* result collation either; but since they are known to
@ -401,11 +402,11 @@ assign_collations_walker(Node *node, assign_collations_context *context)
case T_RowExpr:
{
/*
* RowExpr is a special case because the subexpressions
* are independent: we don't want to complain if some of
* them have incompatible explicit collations.
* RowExpr is a special case because the subexpressions are
* independent: we don't want to complain if some of them have
* incompatible explicit collations.
*/
RowExpr *expr = (RowExpr *) node;
RowExpr *expr = (RowExpr *) node;
assign_list_collations(context->pstate, expr->args);
@ -414,7 +415,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
* has a collation, we can just stop here: this node has no
* impact on the collation of its parent.
*/
return false; /* done */
return false; /* done */
}
case T_RowCompareExpr:
{
@ -431,9 +432,9 @@ assign_collations_walker(Node *node, assign_collations_context *context)
forboth(l, expr->largs, r, expr->rargs)
{
Node *le = (Node *) lfirst(l);
Node *re = (Node *) lfirst(r);
Oid coll;
Node *le = (Node *) lfirst(l);
Node *re = (Node *) lfirst(r);
Oid coll;
coll = select_common_collation(context->pstate,
list_make2(le, re),
@ -443,11 +444,11 @@ assign_collations_walker(Node *node, assign_collations_context *context)
expr->inputcollids = colls;
/*
* Since the result is always boolean and therefore never
* has a collation, we can just stop here: this node has no
* impact on the collation of its parent.
* Since the result is always boolean and therefore never has
* a collation, we can just stop here: this node has no impact
* on the collation of its parent.
*/
return false; /* done */
return false; /* done */
}
case T_CoerceToDomain:
{
@ -455,12 +456,12 @@ assign_collations_walker(Node *node, assign_collations_context *context)
* If the domain declaration included a non-default COLLATE
* spec, then use that collation as the output collation of
* the coercion. Otherwise allow the input collation to
* bubble up. (The input should be of the domain's base
* type, therefore we don't need to worry about it not being
* bubble up. (The input should be of the domain's base type,
* therefore we don't need to worry about it not being
* collatable when the domain is.)
*/
CoerceToDomain *expr = (CoerceToDomain *) node;
Oid typcollation = get_typcollation(expr->resulttype);
Oid typcollation = get_typcollation(expr->resulttype);
/* ... but first, recurse */
(void) expression_tree_walker(node,
@ -510,7 +511,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
/*
* TargetEntry can have only one child, and should bubble that
* state up to its parent. We can't use the general-case code
* state up to its parent. We can't use the general-case code
* below because exprType and friends don't work on TargetEntry.
*/
collation = loccontext.collation;
@ -525,9 +526,9 @@ assign_collations_walker(Node *node, assign_collations_context *context)
* There are some cases where there might not be a failure, for
* example if the planner chooses to use hash aggregation instead
* of sorting for grouping; but it seems better to predictably
* throw an error. (Compare transformSetOperationTree, which will
* throw error for indeterminate collation of set-op columns,
* even though the planner might be able to implement the set-op
* throw an error. (Compare transformSetOperationTree, which will
* throw error for indeterminate collation of set-op columns, even
* though the planner might be able to implement the set-op
* without sorting.)
*/
if (strength == COLLATE_CONFLICT &&
@ -548,6 +549,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
(void) expression_tree_walker(node,
assign_collations_walker,
(void *) &loccontext);
/*
* When we're invoked on a query's jointree, we don't need to do
* anything with join nodes except recurse through them to process
@ -599,6 +601,7 @@ assign_collations_walker(Node *node, assign_collations_context *context)
case T_CaseTestExpr:
case T_SetToDefault:
case T_CurrentOfExpr:
/*
* General case for childless expression nodes. These should
* already have a collation assigned; it is not this function's
@ -610,10 +613,10 @@ assign_collations_walker(Node *node, assign_collations_context *context)
/*
* Note: in most cases, there will be an assigned collation
* whenever type_is_collatable(exprType(node)); but an exception
* occurs for a Var referencing a subquery output column for
* which a unique collation was not determinable. That may lead
* to a runtime failure if a collation-sensitive function is
* applied to the Var.
* occurs for a Var referencing a subquery output column for which
* a unique collation was not determinable. That may lead to a
* runtime failure if a collation-sensitive function is applied to
* the Var.
*/
if (OidIsValid(collation))
@ -626,10 +629,10 @@ assign_collations_walker(Node *node, assign_collations_context *context)
default:
{
/*
* General case for most expression nodes with children.
* First recurse, then figure out what to assign here.
* General case for most expression nodes with children. First
* recurse, then figure out what to assign here.
*/
Oid typcollation;
Oid typcollation;
(void) expression_tree_walker(node,
assign_collations_walker,
@ -668,9 +671,9 @@ assign_collations_walker(Node *node, assign_collations_context *context)
}
/*
* Save the result collation into the expression node.
* If the state is COLLATE_CONFLICT, we'll set the collation
* to InvalidOid, which might result in an error at runtime.
* Save the result collation into the expression node. If the
* state is COLLATE_CONFLICT, we'll set the collation to
* InvalidOid, which might result in an error at runtime.
*/
if (strength == COLLATE_CONFLICT)
exprSetCollation(node, InvalidOid);

View File

@ -245,7 +245,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
cte->ctequery = (Node *) query;
/*
* Check that we got something reasonable. These first two cases should
* Check that we got something reasonable. These first two cases should
* be prevented by the grammar.
*/
if (!IsA(query, Query))
@ -310,7 +310,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
continue;
varattno++;
Assert(varattno == te->resno);
if (lctyp == NULL || lctypmod == NULL || lccoll == NULL) /* shouldn't happen */
if (lctyp == NULL || lctypmod == NULL || lccoll == NULL) /* shouldn't happen */
elog(ERROR, "wrong number of output columns in WITH");
texpr = (Node *) te->expr;
if (exprType(texpr) != lfirst_oid(lctyp) ||
@ -338,7 +338,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
lctypmod = lnext(lctypmod);
lccoll = lnext(lccoll);
}
if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */
if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */
elog(ERROR, "wrong number of output columns in WITH");
}
}
@ -645,7 +645,7 @@ checkWellFormedRecursion(CteState *cstate)
CommonTableExpr *cte = cstate->items[i].cte;
SelectStmt *stmt = (SelectStmt *) cte->ctequery;
Assert(!IsA(stmt, Query)); /* not analyzed yet */
Assert(!IsA(stmt, Query)); /* not analyzed yet */
/* Ignore items that weren't found to be recursive */
if (!cte->cterecursive)

View File

@ -163,6 +163,7 @@ transformExpr(ParseState *pstate, Node *expr)
typenameTypeIdAndMod(pstate, tc->typeName,
&targetType, &targetTypmod);
/*
* If target is a domain over array, work with the base
* array type here. transformTypeCast below will cast the
@ -1283,9 +1284,9 @@ transformCaseExpr(ParseState *pstate, CaseExpr *c)
/*
* Run collation assignment on the test expression so that we know
* what collation to mark the placeholder with. In principle we
* could leave it to parse_collate.c to do that later, but propagating
* the result to the CaseTestExpr would be unnecessarily complicated.
* what collation to mark the placeholder with. In principle we could
* leave it to parse_collate.c to do that later, but propagating the
* result to the CaseTestExpr would be unnecessarily complicated.
*/
assign_expr_collations(pstate, arg);
@ -2122,15 +2123,16 @@ static Node *
transformCollateClause(ParseState *pstate, CollateClause *c)
{
CollateExpr *newc;
Oid argtype;
Oid argtype;
newc = makeNode(CollateExpr);
newc->arg = (Expr *) transformExpr(pstate, c->arg);
argtype = exprType((Node *) newc->arg);
/*
* The unknown type is not collatable, but coerce_type() takes
* care of it separately, so we'll let it go here.
* The unknown type is not collatable, but coerce_type() takes care of it
* separately, so we'll let it go here.
*/
if (!type_is_collatable(argtype) && argtype != UNKNOWNOID)
ereport(ERROR,
@ -2351,7 +2353,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
rcexpr->rctype = rctype;
rcexpr->opnos = opnos;
rcexpr->opfamilies = opfamilies;
rcexpr->inputcollids = NIL; /* assign_expr_collations will fix this */
rcexpr->inputcollids = NIL; /* assign_expr_collations will fix this */
rcexpr->largs = largs;
rcexpr->rargs = rargs;

View File

@ -288,9 +288,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
errmsg("function %s does not exist",
func_signature_string(funcname, nargs, argnames,
actual_arg_types)),
errhint("No aggregate function matches the given name and argument types. "
"Perhaps you misplaced ORDER BY; ORDER BY must appear "
"after all regular arguments of the aggregate."),
errhint("No aggregate function matches the given name and argument types. "
"Perhaps you misplaced ORDER BY; ORDER BY must appear "
"after all regular arguments of the aggregate."),
parser_errposition(pstate, location)));
}
else
@ -1034,7 +1034,7 @@ func_get_detail(List *funcname,
case COERCION_PATH_COERCEVIAIO:
if ((sourceType == RECORDOID ||
ISCOMPLEX(sourceType)) &&
TypeCategory(targetType) == TYPCATEGORY_STRING)
TypeCategory(targetType) == TYPCATEGORY_STRING)
iscoercion = false;
else
iscoercion = true;

View File

@ -220,7 +220,7 @@ transformArrayType(Oid *arrayType, int32 *arrayTypmod)
* If the input is a domain, smash to base type, and extract the actual
* typmod to be applied to the base type. Subscripting a domain is an
* operation that necessarily works on the base array type, not the domain
* itself. (Note that we provide no method whereby the creator of a
* itself. (Note that we provide no method whereby the creator of a
* domain over an array type could hide its ability to be subscripted.)
*/
*arrayType = getBaseTypeAndTypmod(*arrayType, arrayTypmod);
@ -290,8 +290,8 @@ transformArraySubscripts(ParseState *pstate,
/*
* Caller may or may not have bothered to determine elementType. Note
* that if the caller did do so, arrayType/arrayTypMod must be as
* modified by transformArrayType, ie, smash domain to base type.
* that if the caller did do so, arrayType/arrayTypMod must be as modified
* by transformArrayType, ie, smash domain to base type.
*/
if (!OidIsValid(elementType))
elementType = transformArrayType(&arrayType, &arrayTypMod);
@ -542,7 +542,7 @@ make_const(ParseState *pstate, Value *value, int location)
con = makeConst(typeid,
-1, /* typmod -1 is OK for all cases */
InvalidOid, /* all cases are uncollatable types */
InvalidOid, /* all cases are uncollatable types */
typelen,
val,
false,

View File

@ -214,9 +214,9 @@ get_sort_group_operators(Oid argtype,
/*
* If the datatype is an array, then we can use array_lt and friends ...
* but only if there are suitable operators for the element type.
* Likewise, array types are only hashable if the element type is.
* Testing all three operator IDs here should be redundant, but let's do
* it anyway.
* Likewise, array types are only hashable if the element type is. Testing
* all three operator IDs here should be redundant, but let's do it
* anyway.
*/
if (lt_opr == ARRAY_LT_OP ||
eq_opr == ARRAY_EQ_OP ||

View File

@ -233,8 +233,8 @@ variable_coerce_param_hook(ParseState *pstate, Param *param,
/*
* This module always sets a Param's collation to be the default for
* its datatype. If that's not what you want, you should be using
* the more general parser substitution hooks.
* its datatype. If that's not what you want, you should be using the
* more general parser substitution hooks.
*/
param->paramcollid = get_typcollation(param->paramtype);

View File

@ -1393,14 +1393,14 @@ addRangeTableEntryForCTE(ParseState *pstate,
*/
if (IsA(cte->ctequery, Query))
{
Query *ctequery = (Query *) cte->ctequery;
Query *ctequery = (Query *) cte->ctequery;
if (ctequery->commandType != CMD_SELECT &&
ctequery->returningList == NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
parser_errposition(pstate, rv->location)));
}
@ -1871,7 +1871,7 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref,
* what type the Const claims to be.
*/
*colvars = lappend(*colvars,
makeNullConst(INT4OID, -1, InvalidOid));
makeNullConst(INT4OID, -1, InvalidOid));
}
}
continue;
@ -1893,7 +1893,7 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref,
Var *varnode;
varnode = makeVar(rtindex, attr->attnum,
attr->atttypid, attr->atttypmod, attr->attcollation,
attr->atttypid, attr->atttypmod, attr->attcollation,
sublevels_up);
varnode->location = location;

View File

@ -671,7 +671,7 @@ transformAssignmentIndirection(ParseState *pstate,
parser_errposition(pstate, location)));
get_atttypetypmodcoll(typrelid, attnum,
&fieldTypeId, &fieldTypMod, &fieldCollation);
&fieldTypeId, &fieldTypMod, &fieldCollation);
/* recurse to create appropriate RHS for field assign */
rhs = transformAssignmentIndirection(pstate,
@ -783,8 +783,8 @@ transformAssignmentSubscripts(ParseState *pstate,
/*
* Array normally has same collation as elements, but there's an
* exception: we might be subscripting a domain over an array type.
* In that case use collation of the base type.
* exception: we might be subscripting a domain over an array type. In
* that case use collation of the base type.
*/
if (arrayType == targetTypeId)
collationNeeded = targetCollation;

View File

@ -121,7 +121,7 @@ static void transformFKConstraints(CreateStmtContext *cxt,
bool skipValidation,
bool isAddConstraint);
static void transformConstraintAttrs(CreateStmtContext *cxt,
List *constraintList);
List *constraintList);
static void transformColumnType(CreateStmtContext *cxt, ColumnDef *column);
static void setSchemaName(char *context_schema, char **stmt_schema_name);
@ -368,8 +368,8 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
* If this is ALTER ADD COLUMN, make sure the sequence will be owned
* by the table's owner. The current user might be someone else
* (perhaps a superuser, or someone who's only a member of the owning
* role), but the SEQUENCE OWNED BY mechanisms will bleat unless
* table and sequence have exactly the same owning role.
* role), but the SEQUENCE OWNED BY mechanisms will bleat unless table
* and sequence have exactly the same owning role.
*/
if (cxt->rel)
seqstmt->ownerId = cxt->rel->rd_rel->relowner;
@ -732,7 +732,7 @@ transformInhRelation(CreateStmtContext *cxt, InhRelation *inhRelation)
/* Copy comment on constraint */
if ((inhRelation->options & CREATE_TABLE_LIKE_COMMENTS) &&
(comment = GetComment(get_constraint_oid(RelationGetRelid(relation),
n->conname, false),
n->conname, false),
ConstraintRelationId,
0)) != NULL)
{
@ -1390,8 +1390,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
/*
* If it's ALTER TABLE ADD CONSTRAINT USING INDEX, look up the index and
* verify it's usable, then extract the implied column name list. (We
* will not actually need the column name list at runtime, but we need
* it now to check for duplicate column entries below.)
* will not actually need the column name list at runtime, but we need it
* now to check for duplicate column entries below.)
*/
if (constraint->indexname != NULL)
{
@ -1436,8 +1436,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (OidIsValid(get_index_constraint(index_oid)))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("index \"%s\" is already associated with a constraint",
index_name),
errmsg("index \"%s\" is already associated with a constraint",
index_name),
parser_errposition(cxt->pstate, constraint->location)));
/* Perform validity checks on the index */
@ -1482,8 +1482,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
parser_errposition(cxt->pstate, constraint->location)));
/*
* It's probably unsafe to change a deferred index to non-deferred.
* (A non-constraint index couldn't be deferred anyway, so this case
* It's probably unsafe to change a deferred index to non-deferred. (A
* non-constraint index couldn't be deferred anyway, so this case
* should never occur; no need to sweat, but let's check it.)
*/
if (!index_form->indimmediate && !constraint->deferrable)
@ -1494,7 +1494,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
parser_errposition(cxt->pstate, constraint->location)));
/*
* Insist on it being a btree. That's the only kind that supports
* Insist on it being a btree. That's the only kind that supports
* uniqueness at the moment anyway; but we must have an index that
* exactly matches what you'd get from plain ADD CONSTRAINT syntax,
* else dump and reload will produce a different index (breaking
@ -1514,15 +1514,15 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
for (i = 0; i < index_form->indnatts; i++)
{
int2 attnum = index_form->indkey.values[i];
int2 attnum = index_form->indkey.values[i];
Form_pg_attribute attform;
char *attname;
Oid defopclass;
char *attname;
Oid defopclass;
/*
* We shouldn't see attnum == 0 here, since we already rejected
* expression indexes. If we do, SystemAttributeDefinition
* will throw an error.
* expression indexes. If we do, SystemAttributeDefinition will
* throw an error.
*/
if (attnum > 0)
{
@ -1531,11 +1531,11 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
}
else
attform = SystemAttributeDefinition(attnum,
heap_rel->rd_rel->relhasoids);
heap_rel->rd_rel->relhasoids);
attname = pstrdup(NameStr(attform->attname));
/*
* Insist on default opclass and sort options. While the index
* Insist on default opclass and sort options. While the index
* would still work as a constraint with non-default settings, it
* might not provide exactly the same uniqueness semantics as
* you'd get from a normally-created constraint; and there's also
@ -1549,7 +1549,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("index \"%s\" does not have default sorting behavior", index_name),
errdetail("Cannot create a PRIMARY KEY or UNIQUE constraint using such an index."),
parser_errposition(cxt->pstate, constraint->location)));
parser_errposition(cxt->pstate, constraint->location)));
constraint->keys = lappend(constraint->keys, makeString(attname));
}
@ -1694,13 +1694,13 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" appears twice in primary key constraint",
key),
parser_errposition(cxt->pstate, constraint->location)));
parser_errposition(cxt->pstate, constraint->location)));
else
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
errmsg("column \"%s\" appears twice in unique constraint",
key),
parser_errposition(cxt->pstate, constraint->location)));
parser_errposition(cxt->pstate, constraint->location)));
}
}
@ -1743,7 +1743,7 @@ transformFKConstraints(CreateStmtContext *cxt,
Constraint *constraint = (Constraint *) lfirst(fkclist);
constraint->skip_validation = true;
constraint->initially_valid = true;
constraint->initially_valid = true;
}
}
@ -2120,18 +2120,18 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
* However, they were already in the outer rangetable when we
* analyzed the query, so we have to check.
*
* Note that in the INSERT...SELECT case, we need to examine
* the CTE lists of both top_subqry and sub_qry.
* Note that in the INSERT...SELECT case, we need to examine the
* CTE lists of both top_subqry and sub_qry.
*
* Note that we aren't digging into the body of the query
* looking for WITHs in nested sub-SELECTs. A WITH down there
* can legitimately refer to OLD/NEW, because it'd be an
* Note that we aren't digging into the body of the query looking
* for WITHs in nested sub-SELECTs. A WITH down there can
* legitimately refer to OLD/NEW, because it'd be an
* indirect-correlated outer reference.
*/
if (rangeTableEntry_used((Node *) top_subqry->cteList,
PRS2_OLD_VARNO, 0) ||
rangeTableEntry_used((Node *) sub_qry->cteList,
PRS2_OLD_VARNO, 0))
PRS2_OLD_VARNO, 0))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot refer to OLD within WITH query")));
@ -2226,12 +2226,13 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
lockmode = AlterTableGetLockLevel(stmt->cmds);
/*
* Acquire appropriate lock on the target relation, which will be held until
* end of transaction. This ensures any decisions we make here based on
* the state of the relation will still be good at execution. We must get
* lock now because execution will later require it; taking a lower grade lock
* now and trying to upgrade later risks deadlock. Any new commands we add
* after this must not upgrade the lock level requested here.
* Acquire appropriate lock on the target relation, which will be held
* until end of transaction. This ensures any decisions we make here
* based on the state of the relation will still be good at execution. We
* must get lock now because execution will later require it; taking a
* lower grade lock now and trying to upgrade later risks deadlock. Any
* new commands we add after this must not upgrade the lock level
* requested here.
*/
rel = relation_openrv(stmt->relation, lockmode);
@ -2522,7 +2523,7 @@ transformColumnType(CreateStmtContext *cxt, ColumnDef *column)
if (column->collClause)
{
Form_pg_type typtup = (Form_pg_type) GETSTRUCT(ctype);
Oid collOid;
Oid collOid;
collOid = LookupCollation(cxt->pstate,
column->collClause->collname,