mirror of
https://github.com/postgres/postgres.git
synced 2025-10-18 04:29:09 +03:00
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
This commit is contained in:
@@ -181,7 +181,7 @@ transformTopLevelStmt(ParseState *pstate, Node *parseTree)
|
||||
/* If it's a set-operation tree, drill down to leftmost SelectStmt */
|
||||
while (stmt && stmt->op != SETOP_NONE)
|
||||
stmt = stmt->larg;
|
||||
Assert(stmt && IsA(stmt, SelectStmt) && stmt->larg == NULL);
|
||||
Assert(stmt && IsA(stmt, SelectStmt) &&stmt->larg == NULL);
|
||||
|
||||
if (stmt->intoClause)
|
||||
{
|
||||
@@ -950,7 +950,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("SELECT ... INTO is not allowed here"),
|
||||
parser_errposition(pstate,
|
||||
exprLocation((Node *) stmt->intoClause))));
|
||||
exprLocation((Node *) stmt->intoClause))));
|
||||
|
||||
/* make FOR UPDATE/FOR SHARE info available to addRangeTableEntry */
|
||||
pstate->p_locking_clause = stmt->lockingClause;
|
||||
@@ -1364,12 +1364,12 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("SELECT ... INTO is not allowed here"),
|
||||
parser_errposition(pstate,
|
||||
exprLocation((Node *) leftmostSelect->intoClause))));
|
||||
exprLocation((Node *) leftmostSelect->intoClause))));
|
||||
|
||||
/*
|
||||
* We need to extract ORDER BY and other top-level clauses here and
|
||||
* not let transformSetOperationTree() see them --- else it'll just
|
||||
* recurse right back here!
|
||||
* We need to extract ORDER BY and other top-level clauses here and not
|
||||
* let transformSetOperationTree() see them --- else it'll just recurse
|
||||
* right back here!
|
||||
*/
|
||||
sortClause = stmt->sortClause;
|
||||
limitOffset = stmt->limitOffset;
|
||||
|
@@ -1302,26 +1302,26 @@ coerce_to_common_type(ParseState *pstate, Node *node,
|
||||
*
|
||||
* 1) All arguments declared ANYELEMENT must have the same datatype.
|
||||
* 2) All arguments declared ANYARRAY must have the same datatype,
|
||||
* which must be a varlena array type.
|
||||
* which must be a varlena array type.
|
||||
* 3) All arguments declared ANYRANGE must have the same datatype,
|
||||
* which must be a range type.
|
||||
* which must be a range type.
|
||||
* 4) If there are arguments of both ANYELEMENT and ANYARRAY, make sure the
|
||||
* actual ANYELEMENT datatype is in fact the element type for the actual
|
||||
* ANYARRAY datatype.
|
||||
* actual ANYELEMENT datatype is in fact the element type for the actual
|
||||
* ANYARRAY datatype.
|
||||
* 5) Similarly, if there are arguments of both ANYELEMENT and ANYRANGE,
|
||||
* make sure the actual ANYELEMENT datatype is in fact the subtype for
|
||||
* the actual ANYRANGE type.
|
||||
* make sure the actual ANYELEMENT datatype is in fact the subtype for
|
||||
* the actual ANYRANGE type.
|
||||
* 6) ANYENUM is treated the same as ANYELEMENT except that if it is used
|
||||
* (alone or in combination with plain ANYELEMENT), we add the extra
|
||||
* condition that the ANYELEMENT type must be an enum.
|
||||
* (alone or in combination with plain ANYELEMENT), we add the extra
|
||||
* condition that the ANYELEMENT type must be an enum.
|
||||
* 7) ANYNONARRAY is treated the same as ANYELEMENT except that if it is used,
|
||||
* we add the extra condition that the ANYELEMENT type must not be an array.
|
||||
* (This is a no-op if used in combination with ANYARRAY or ANYENUM, but
|
||||
* is an extra restriction if not.)
|
||||
* we add the extra condition that the ANYELEMENT type must not be an array.
|
||||
* (This is a no-op if used in combination with ANYARRAY or ANYENUM, but
|
||||
* is an extra restriction if not.)
|
||||
*
|
||||
* Domains over arrays match ANYARRAY, and are immediately flattened to their
|
||||
* base type. (Thus, for example, we will consider it a match if one ANYARRAY
|
||||
* argument is a domain over int4[] while another one is just int4[].) Also
|
||||
* argument is a domain over int4[] while another one is just int4[].) Also
|
||||
* notice that such a domain does *not* match ANYNONARRAY.
|
||||
*
|
||||
* Similarly, domains over ranges match ANYRANGE, and are immediately
|
||||
@@ -1475,7 +1475,7 @@ check_generic_type_consistency(Oid *actual_arg_types,
|
||||
*
|
||||
* If any polymorphic pseudotype is used in a function's arguments or
|
||||
* return type, we make sure the actual data types are consistent with
|
||||
* each other. The argument consistency rules are shown above for
|
||||
* each other. The argument consistency rules are shown above for
|
||||
* check_generic_type_consistency().
|
||||
*
|
||||
* If we have UNKNOWN input (ie, an untyped literal) for any polymorphic
|
||||
@@ -1487,35 +1487,35 @@ check_generic_type_consistency(Oid *actual_arg_types,
|
||||
* if it is declared as a polymorphic type:
|
||||
*
|
||||
* 1) If return type is ANYARRAY, and any argument is ANYARRAY, use the
|
||||
* argument's actual type as the function's return type.
|
||||
* argument's actual type as the function's return type.
|
||||
* 2) Similarly, if return type is ANYRANGE, and any argument is ANYRANGE,
|
||||
* use the argument's actual type as the function's return type.
|
||||
* use the argument's actual type as the function's return type.
|
||||
* 3) If return type is ANYARRAY, no argument is ANYARRAY, but any argument is
|
||||
* ANYELEMENT, use the actual type of the argument to determine the
|
||||
* function's return type, i.e. the element type's corresponding array
|
||||
* type. (Note: similar behavior does not exist for ANYRANGE, because it's
|
||||
* impossible to determine the range type from the subtype alone.)
|
||||
* ANYELEMENT, use the actual type of the argument to determine the
|
||||
* function's return type, i.e. the element type's corresponding array
|
||||
* type. (Note: similar behavior does not exist for ANYRANGE, because it's
|
||||
* impossible to determine the range type from the subtype alone.)
|
||||
* 4) If return type is ANYARRAY, but no argument is ANYARRAY or ANYELEMENT,
|
||||
* generate an error. Similarly, if return type is ANYRANGE, but no
|
||||
* argument is ANYRANGE, generate an error. (These conditions are
|
||||
* prevented by CREATE FUNCTION and therefore are not expected here.)
|
||||
* generate an error. Similarly, if return type is ANYRANGE, but no
|
||||
* argument is ANYRANGE, generate an error. (These conditions are
|
||||
* prevented by CREATE FUNCTION and therefore are not expected here.)
|
||||
* 5) If return type is ANYELEMENT, and any argument is ANYELEMENT, use the
|
||||
* argument's actual type as the function's return type.
|
||||
* argument's actual type as the function's return type.
|
||||
* 6) If return type is ANYELEMENT, no argument is ANYELEMENT, but any argument
|
||||
* is ANYARRAY or ANYRANGE, use the actual type of the argument to determine
|
||||
* the function's return type, i.e. the array type's corresponding element
|
||||
* type or the range type's corresponding subtype (or both, in which case
|
||||
* they must match).
|
||||
* is ANYARRAY or ANYRANGE, use the actual type of the argument to determine
|
||||
* the function's return type, i.e. the array type's corresponding element
|
||||
* type or the range type's corresponding subtype (or both, in which case
|
||||
* they must match).
|
||||
* 7) If return type is ANYELEMENT, no argument is ANYELEMENT, ANYARRAY, or
|
||||
* ANYRANGE, generate an error. (This condition is prevented by CREATE
|
||||
* FUNCTION and therefore is not expected here.)
|
||||
* ANYRANGE, generate an error. (This condition is prevented by CREATE
|
||||
* FUNCTION and therefore is not expected here.)
|
||||
* 8) ANYENUM is treated the same as ANYELEMENT except that if it is used
|
||||
* (alone or in combination with plain ANYELEMENT), we add the extra
|
||||
* condition that the ANYELEMENT type must be an enum.
|
||||
* (alone or in combination with plain ANYELEMENT), we add the extra
|
||||
* condition that the ANYELEMENT type must be an enum.
|
||||
* 9) ANYNONARRAY is treated the same as ANYELEMENT except that if it is used,
|
||||
* we add the extra condition that the ANYELEMENT type must not be an array.
|
||||
* (This is a no-op if used in combination with ANYARRAY or ANYENUM, but
|
||||
* is an extra restriction if not.)
|
||||
* we add the extra condition that the ANYELEMENT type must not be an array.
|
||||
* (This is a no-op if used in combination with ANYARRAY or ANYENUM, but
|
||||
* is an extra restriction if not.)
|
||||
*
|
||||
* Domains over arrays or ranges match ANYARRAY or ANYRANGE arguments,
|
||||
* respectively, and are immediately flattened to their base type. (In
|
||||
@@ -1524,14 +1524,14 @@ check_generic_type_consistency(Oid *actual_arg_types,
|
||||
*
|
||||
* When allow_poly is false, we are not expecting any of the actual_arg_types
|
||||
* to be polymorphic, and we should not return a polymorphic result type
|
||||
* either. When allow_poly is true, it is okay to have polymorphic "actual"
|
||||
* either. When allow_poly is true, it is okay to have polymorphic "actual"
|
||||
* arg types, and we can return ANYARRAY, ANYRANGE, or ANYELEMENT as the
|
||||
* result. (This case is currently used only to check compatibility of an
|
||||
* result. (This case is currently used only to check compatibility of an
|
||||
* aggregate's declaration with the underlying transfn.)
|
||||
*
|
||||
* A special case is that we could see ANYARRAY as an actual_arg_type even
|
||||
* when allow_poly is false (this is possible only because pg_statistic has
|
||||
* columns shown as anyarray in the catalogs). We allow this to match a
|
||||
* columns shown as anyarray in the catalogs). We allow this to match a
|
||||
* declared ANYARRAY argument, but only if there is no ANYELEMENT argument
|
||||
* or result (since we can't determine a specific element type to match to
|
||||
* ANYELEMENT). Note this means that functions taking ANYARRAY had better
|
||||
|
@@ -844,7 +844,7 @@ transformAExprOp(ParseState *pstate, A_Expr *a)
|
||||
list_length(a->name) == 1 &&
|
||||
strcmp(strVal(linitial(a->name)), "=") == 0 &&
|
||||
(exprIsNullConstant(lexpr) || exprIsNullConstant(rexpr)) &&
|
||||
(!IsA(lexpr, CaseTestExpr) && !IsA(rexpr, CaseTestExpr)))
|
||||
(!IsA(lexpr, CaseTestExpr) &&!IsA(rexpr, CaseTestExpr)))
|
||||
{
|
||||
NullTest *n = makeNode(NullTest);
|
||||
|
||||
@@ -2066,9 +2066,9 @@ transformWholeRowRef(ParseState *pstate, RangeTblEntry *rte, int location)
|
||||
vnum = RTERangeTablePosn(pstate, rte, &sublevels_up);
|
||||
|
||||
/*
|
||||
* Build the appropriate referencing node. Note that if the RTE is a
|
||||
* Build the appropriate referencing node. Note that if the RTE is a
|
||||
* function returning scalar, we create just a plain reference to the
|
||||
* function value, not a composite containing a single column. This is
|
||||
* function value, not a composite containing a single column. This is
|
||||
* pretty inconsistent at first sight, but it's what we've done
|
||||
* historically. One argument for it is that "rel" and "rel.*" mean the
|
||||
* same thing for composite relations, so why not for scalar functions...
|
||||
@@ -2268,8 +2268,8 @@ make_row_comparison_op(ParseState *pstate, List *opname,
|
||||
opinfo_lists[i] = get_op_btree_interpretation(opno);
|
||||
|
||||
/*
|
||||
* convert strategy numbers into a Bitmapset to make the
|
||||
* intersection calculation easy.
|
||||
* convert strategy numbers into a Bitmapset to make the intersection
|
||||
* calculation easy.
|
||||
*/
|
||||
this_strats = NULL;
|
||||
foreach(j, opinfo_lists[i])
|
||||
|
@@ -787,9 +787,9 @@ func_select_candidate(int nargs,
|
||||
* Having completed this examination, remove candidates that accept the
|
||||
* wrong category at any unknown position. Also, if at least one
|
||||
* candidate accepted a preferred type at a position, remove candidates
|
||||
* that accept non-preferred types. If just one candidate remains,
|
||||
* return that one. However, if this rule turns out to reject all
|
||||
* candidates, keep them all instead.
|
||||
* that accept non-preferred types. If just one candidate remains, return
|
||||
* that one. However, if this rule turns out to reject all candidates,
|
||||
* keep them all instead.
|
||||
*/
|
||||
resolved_unknowns = false;
|
||||
for (i = 0; i < nargs; i++)
|
||||
@@ -914,7 +914,7 @@ func_select_candidate(int nargs,
|
||||
* type, and see if that gives us a unique match. If so, use that match.
|
||||
*
|
||||
* NOTE: for a binary operator with one unknown and one non-unknown input,
|
||||
* we already tried this heuristic in binary_oper_exact(). However, that
|
||||
* we already tried this heuristic in binary_oper_exact(). However, that
|
||||
* code only finds exact matches, whereas here we will handle matches that
|
||||
* involve coercion, polymorphic type resolution, etc.
|
||||
*/
|
||||
|
@@ -274,10 +274,11 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
|
||||
* relation.
|
||||
*
|
||||
* NB: It's not critical that RangeVarGetRelid return the correct answer
|
||||
* here in the face of concurrent DDL. If it doesn't, the worst case
|
||||
* scenario is a less-clear error message. Also, the tables involved in
|
||||
* here in the face of concurrent DDL. If it doesn't, the worst case
|
||||
* scenario is a less-clear error message. Also, the tables involved in
|
||||
* the query are already locked, which reduces the number of cases in
|
||||
* which surprising behavior can occur. So we do the name lookup unlocked.
|
||||
* which surprising behavior can occur. So we do the name lookup
|
||||
* unlocked.
|
||||
*/
|
||||
if (!relation->schemaname)
|
||||
cte = scanNameSpaceForCTE(pstate, refname, &ctelevelsup);
|
||||
|
@@ -1622,7 +1622,7 @@ FigureColnameInternal(Node *node, char **name)
|
||||
case EXPR_SUBLINK:
|
||||
{
|
||||
/* Get column name of the subquery's single target */
|
||||
SubLink *sublink = (SubLink *) node;
|
||||
SubLink *sublink = (SubLink *) node;
|
||||
Query *query = (Query *) sublink->subselect;
|
||||
|
||||
/*
|
||||
@@ -1644,7 +1644,7 @@ FigureColnameInternal(Node *node, char **name)
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* As with other operator-like nodes, these have no names */
|
||||
/* As with other operator-like nodes, these have no names */
|
||||
case ALL_SUBLINK:
|
||||
case ANY_SUBLINK:
|
||||
case ROWCOMPARE_SUBLINK:
|
||||
|
@@ -111,8 +111,8 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName,
|
||||
/*
|
||||
* Look up the field.
|
||||
*
|
||||
* XXX: As no lock is taken here, this might fail in the presence
|
||||
* of concurrent DDL. But taking a lock would carry a performance
|
||||
* XXX: As no lock is taken here, this might fail in the presence of
|
||||
* concurrent DDL. But taking a lock would carry a performance
|
||||
* penalty and would also require a permissions check.
|
||||
*/
|
||||
relid = RangeVarGetRelid(rel, NoLock, false);
|
||||
|
@@ -103,7 +103,7 @@ static void transformColumnDefinition(CreateStmtContext *cxt,
|
||||
static void transformTableConstraint(CreateStmtContext *cxt,
|
||||
Constraint *constraint);
|
||||
static void transformTableLikeClause(CreateStmtContext *cxt,
|
||||
TableLikeClause *table_like_clause);
|
||||
TableLikeClause *table_like_clause);
|
||||
static void transformOfType(CreateStmtContext *cxt,
|
||||
TypeName *ofTypename);
|
||||
static char *chooseIndexName(const RangeVar *relation, IndexStmt *index_stmt);
|
||||
@@ -309,7 +309,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
||||
column->typeName->typeOid = INT2OID;
|
||||
}
|
||||
else if (strcmp(typname, "serial") == 0 ||
|
||||
strcmp(typname, "serial4") == 0)
|
||||
strcmp(typname, "serial4") == 0)
|
||||
{
|
||||
is_serial = true;
|
||||
column->typeName->names = NIL;
|
||||
@@ -554,13 +554,13 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate ALTER FOREIGN TABLE ALTER COLUMN statement which adds
|
||||
* Generate ALTER FOREIGN TABLE ALTER COLUMN statement which adds
|
||||
* per-column foreign data wrapper options for this column.
|
||||
*/
|
||||
if (column->fdwoptions != NIL)
|
||||
{
|
||||
AlterTableStmt *stmt;
|
||||
AlterTableCmd *cmd;
|
||||
AlterTableCmd *cmd;
|
||||
|
||||
cmd = makeNode(AlterTableCmd);
|
||||
cmd->subtype = AT_AlterColumnGenericOptions;
|
||||
@@ -667,7 +667,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
|
||||
else
|
||||
{
|
||||
aclresult = pg_class_aclcheck(RelationGetRelid(relation), GetUserId(),
|
||||
ACL_SELECT);
|
||||
ACL_SELECT);
|
||||
if (aclresult != ACLCHECK_OK)
|
||||
aclcheck_error(aclresult, ACL_KIND_CLASS,
|
||||
RelationGetRelationName(relation));
|
||||
@@ -803,7 +803,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
|
||||
/* Copy comment on constraint */
|
||||
if ((table_like_clause->options & CREATE_TABLE_LIKE_COMMENTS) &&
|
||||
(comment = GetComment(get_relation_constraint_oid(RelationGetRelid(relation),
|
||||
n->conname, false),
|
||||
n->conname, false),
|
||||
ConstraintRelationId,
|
||||
0)) != NULL)
|
||||
{
|
||||
@@ -2305,7 +2305,7 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
|
||||
/* this message is consistent with relation_openrv */
|
||||
ereport(NOTICE,
|
||||
(errmsg("relation \"%s\" does not exist, skipping",
|
||||
stmt->relation->relname)));
|
||||
stmt->relation->relname)));
|
||||
return NIL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user