mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
pgindent run for release 9.3
This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
This commit is contained in:
@ -678,7 +678,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Process INSERT ... VALUES with a single VALUES sublist. We treat
|
||||
* Process INSERT ... VALUES with a single VALUES sublist. We treat
|
||||
* this case separately for efficiency. The sublist is just computed
|
||||
* directly as the Query's targetlist, with no VALUES RTE. So it
|
||||
* works just like a SELECT without any FROM.
|
||||
@ -1178,7 +1178,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
|
||||
/*
|
||||
* Ordinarily there can't be any current-level Vars in the expression
|
||||
* lists, because the namespace was empty ... but if we're inside CREATE
|
||||
* RULE, then NEW/OLD references might appear. In that case we have to
|
||||
* RULE, then NEW/OLD references might appear. In that case we have to
|
||||
* mark the VALUES RTE as LATERAL.
|
||||
*/
|
||||
if (pstate->p_rtable != NIL &&
|
||||
@ -2158,7 +2158,7 @@ transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
|
||||
|
||||
/*
|
||||
* A materialized view would either need to save parameters for use in
|
||||
* maintaining/loading the data or prohibit them entirely. The latter
|
||||
* maintaining/loading the data or prohibit them entirely. The latter
|
||||
* seems safer and more sane.
|
||||
*/
|
||||
if (query_contains_extern_params(query))
|
||||
@ -2167,10 +2167,10 @@ transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
|
||||
errmsg("materialized views may not be defined using bound parameters")));
|
||||
|
||||
/*
|
||||
* For now, we disallow unlogged materialized views, because it
|
||||
* seems like a bad idea for them to just go to empty after a crash.
|
||||
* (If we could mark them as unpopulated, that would be better, but
|
||||
* that requires catalog changes which crash recovery can't presently
|
||||
* For now, we disallow unlogged materialized views, because it seems
|
||||
* like a bad idea for them to just go to empty after a crash. (If we
|
||||
* could mark them as unpopulated, that would be better, but that
|
||||
* requires catalog changes which crash recovery can't presently
|
||||
* handle.)
|
||||
*/
|
||||
if (stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
|
||||
@ -2211,23 +2211,23 @@ CheckSelectLocking(Query *qry)
|
||||
if (qry->distinctClause != NIL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("row-level locks are not allowed with DISTINCT clause")));
|
||||
errmsg("row-level locks are not allowed with DISTINCT clause")));
|
||||
if (qry->groupClause != NIL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("row-level locks are not allowed with GROUP BY clause")));
|
||||
errmsg("row-level locks are not allowed with GROUP BY clause")));
|
||||
if (qry->havingQual != NULL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("row-level locks are not allowed with HAVING clause")));
|
||||
errmsg("row-level locks are not allowed with HAVING clause")));
|
||||
if (qry->hasAggs)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("row-level locks are not allowed with aggregate functions")));
|
||||
errmsg("row-level locks are not allowed with aggregate functions")));
|
||||
if (qry->hasWindowFuncs)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("row-level locks are not allowed with window functions")));
|
||||
errmsg("row-level locks are not allowed with window functions")));
|
||||
if (expression_returns_set((Node *) qry->targetList))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
@ -2394,8 +2394,8 @@ applyLockingClause(Query *qry, Index rtindex,
|
||||
{
|
||||
/*
|
||||
* If the same RTE is specified for more than one locking strength,
|
||||
* treat is as the strongest. (Reasonable, since you can't take both a
|
||||
* shared and exclusive lock at the same time; it'll end up being
|
||||
* treat is as the strongest. (Reasonable, since you can't take both
|
||||
* a shared and exclusive lock at the same time; it'll end up being
|
||||
* exclusive anyway.)
|
||||
*
|
||||
* We also consider that NOWAIT wins if it's specified both ways. This
|
||||
|
@ -9,7 +9,7 @@
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $gram_filename = $ARGV[0];
|
||||
my $gram_filename = $ARGV[0];
|
||||
my $kwlist_filename = $ARGV[1];
|
||||
|
||||
my $errors = 0;
|
||||
@ -52,6 +52,7 @@ line: while (<GRAM>)
|
||||
|
||||
if (!($kcat))
|
||||
{
|
||||
|
||||
# Is this the beginning of a keyword list?
|
||||
foreach $k (keys %keyword_categories)
|
||||
{
|
||||
@ -81,6 +82,7 @@ line: while (<GRAM>)
|
||||
}
|
||||
elsif ($arr[$fieldIndexer] eq '/*')
|
||||
{
|
||||
|
||||
# start of a multiline comment
|
||||
$comment = 1;
|
||||
next;
|
||||
@ -92,6 +94,7 @@ line: while (<GRAM>)
|
||||
|
||||
if ($arr[$fieldIndexer] eq ';')
|
||||
{
|
||||
|
||||
# end of keyword list
|
||||
$kcat = '';
|
||||
next;
|
||||
@ -116,6 +119,7 @@ foreach $kcat (keys %keyword_categories)
|
||||
|
||||
foreach $kword (@{ $keywords{$kcat} })
|
||||
{
|
||||
|
||||
# Some keyword have a _P suffix. Remove it for the comparison.
|
||||
$bare_kword = $kword;
|
||||
$bare_kword =~ s/_P$//;
|
||||
@ -206,6 +210,7 @@ kwlist_line: while (<KWLIST>)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# Remove it from the hash, so that we can
|
||||
# complain at the end if there's keywords left
|
||||
# that were not found in kwlist.h
|
||||
|
@ -286,7 +286,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg,
|
||||
if (errkind)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_GROUPING_ERROR),
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
errmsg("aggregate functions are not allowed in %s",
|
||||
ParseExprKindName(pstate->p_expr_kind)),
|
||||
parser_errposition(pstate, agg->location)));
|
||||
@ -554,7 +554,7 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
|
||||
if (errkind)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WINDOWING_ERROR),
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
errmsg("window functions are not allowed in %s",
|
||||
ParseExprKindName(pstate->p_expr_kind)),
|
||||
parser_errposition(pstate, wfunc->location)));
|
||||
|
@ -604,7 +604,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
|
||||
* *top_rti: receives the rangetable index of top_rte. (Ditto.)
|
||||
*
|
||||
* *namespace: receives a List of ParseNamespaceItems for the RTEs exposed
|
||||
* as table/column names by this item. (The lateral_only flags in these items
|
||||
* as table/column names by this item. (The lateral_only flags in these items
|
||||
* are indeterminate and should be explicitly set by the caller before use.)
|
||||
*/
|
||||
static Node *
|
||||
@ -715,8 +715,8 @@ transformFromClauseItem(ParseState *pstate, Node *n,
|
||||
/*
|
||||
* Make the left-side RTEs available for LATERAL access within the
|
||||
* right side, by temporarily adding them to the pstate's namespace
|
||||
* list. Per SQL:2008, if the join type is not INNER or LEFT then
|
||||
* the left-side names must still be exposed, but it's an error to
|
||||
* list. Per SQL:2008, if the join type is not INNER or LEFT then the
|
||||
* left-side names must still be exposed, but it's an error to
|
||||
* reference them. (Stupid design, but that's what it says.) Hence,
|
||||
* we always push them into the namespace, but mark them as not
|
||||
* lateral_ok if the jointype is wrong.
|
||||
@ -980,7 +980,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
|
||||
*
|
||||
* Note: if there are nested alias-less JOINs, the lower-level ones
|
||||
* will remain in the list although they have neither p_rel_visible
|
||||
* nor p_cols_visible set. We could delete such list items, but it's
|
||||
* nor p_cols_visible set. We could delete such list items, but it's
|
||||
* unclear that it's worth expending cycles to do so.
|
||||
*/
|
||||
if (j->alias != NULL)
|
||||
@ -1282,20 +1282,20 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle,
|
||||
contain_aggs_of_level((Node *) tle->expr, 0))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_GROUPING_ERROR),
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
errmsg("aggregate functions are not allowed in %s",
|
||||
ParseExprKindName(exprKind)),
|
||||
parser_errposition(pstate,
|
||||
locate_agg_of_level((Node *) tle->expr, 0))));
|
||||
locate_agg_of_level((Node *) tle->expr, 0))));
|
||||
if (pstate->p_hasWindowFuncs &&
|
||||
contain_windowfuncs((Node *) tle->expr))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WINDOWING_ERROR),
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
/* translator: %s is name of a SQL construct, eg GROUP BY */
|
||||
errmsg("window functions are not allowed in %s",
|
||||
ParseExprKindName(exprKind)),
|
||||
parser_errposition(pstate,
|
||||
locate_windowfunc((Node *) tle->expr))));
|
||||
locate_windowfunc((Node *) tle->expr))));
|
||||
break;
|
||||
case EXPR_KIND_ORDER_BY:
|
||||
/* no extra checks needed */
|
||||
@ -1324,7 +1324,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle,
|
||||
*
|
||||
* node the ORDER BY, GROUP BY, or DISTINCT ON expression to be matched
|
||||
* tlist the target list (passed by reference so we can append to it)
|
||||
* exprKind identifies clause type being processed
|
||||
* exprKind identifies clause type being processed
|
||||
*/
|
||||
static TargetEntry *
|
||||
findTargetlistEntrySQL92(ParseState *pstate, Node *node, List **tlist,
|
||||
@ -1491,7 +1491,7 @@ findTargetlistEntrySQL92(ParseState *pstate, Node *node, List **tlist,
|
||||
*
|
||||
* node the ORDER BY, GROUP BY, etc expression to be matched
|
||||
* tlist the target list (passed by reference so we can append to it)
|
||||
* exprKind identifies clause type being processed
|
||||
* exprKind identifies clause type being processed
|
||||
*/
|
||||
static TargetEntry *
|
||||
findTargetlistEntrySQL99(ParseState *pstate, Node *node, List **tlist,
|
||||
|
@ -251,7 +251,7 @@ transformExprRecurse(ParseState *pstate, Node *expr)
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized A_Expr kind: %d", a->kind);
|
||||
result = NULL; /* keep compiler quiet */
|
||||
result = NULL; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1411,9 +1411,9 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
|
||||
return result;
|
||||
|
||||
/*
|
||||
* Check to see if the sublink is in an invalid place within the query.
|
||||
* We allow sublinks everywhere in SELECT/INSERT/UPDATE/DELETE, but
|
||||
* generally not in utility statements.
|
||||
* Check to see if the sublink is in an invalid place within the query. We
|
||||
* allow sublinks everywhere in SELECT/INSERT/UPDATE/DELETE, but generally
|
||||
* not in utility statements.
|
||||
*/
|
||||
err = NULL;
|
||||
switch (pstate->p_expr_kind)
|
||||
@ -2031,7 +2031,7 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
|
||||
xexpr = makeNode(XmlExpr);
|
||||
xexpr->op = IS_XMLSERIALIZE;
|
||||
xexpr->args = list_make1(coerce_to_specific_type(pstate,
|
||||
transformExprRecurse(pstate, xs->expr),
|
||||
transformExprRecurse(pstate, xs->expr),
|
||||
XMLOID,
|
||||
"XMLSERIALIZE"));
|
||||
|
||||
|
@ -285,7 +285,7 @@ isFutureCTE(ParseState *pstate, const char *refname)
|
||||
*
|
||||
* This is different from refnameRangeTblEntry in that it considers every
|
||||
* entry in the ParseState's rangetable(s), not only those that are currently
|
||||
* visible in the p_namespace list(s). This behavior is invalid per the SQL
|
||||
* visible in the p_namespace list(s). This behavior is invalid per the SQL
|
||||
* spec, and it may give ambiguous results (there might be multiple equally
|
||||
* valid matches, but only one will be returned). This must be used ONLY
|
||||
* as a heuristic in giving suitable error messages. See errorMissingRTE.
|
||||
@ -639,7 +639,7 @@ colNameToVar(ParseState *pstate, char *colname, bool localonly,
|
||||
*
|
||||
* This is different from colNameToVar in that it considers every entry in
|
||||
* the ParseState's rangetable(s), not only those that are currently visible
|
||||
* in the p_namespace list(s). This behavior is invalid per the SQL spec,
|
||||
* in the p_namespace list(s). This behavior is invalid per the SQL spec,
|
||||
* and it may give ambiguous results (there might be multiple equally valid
|
||||
* matches, but only one will be returned). This must be used ONLY as a
|
||||
* heuristic in giving suitable error messages. See errorMissingColumn.
|
||||
|
@ -76,7 +76,7 @@ static int FigureColnameInternal(Node *node, char **name);
|
||||
*
|
||||
* node the (untransformed) parse tree for the value expression.
|
||||
* expr the transformed expression, or NULL if caller didn't do it yet.
|
||||
* exprKind expression kind (EXPR_KIND_SELECT_TARGET, etc)
|
||||
* exprKind expression kind (EXPR_KIND_SELECT_TARGET, etc)
|
||||
* colname the column name to be assigned, or NULL if none yet set.
|
||||
* resjunk true if the target should be marked resjunk, ie, it is not
|
||||
* wanted in the final projected tuple.
|
||||
@ -1130,7 +1130,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
|
||||
* Transforms '*' (in the target list) into a list of targetlist entries.
|
||||
*
|
||||
* tlist entries are generated for each relation visible for unqualified
|
||||
* column name access. We do not consider qualified-name-only entries because
|
||||
* column name access. We do not consider qualified-name-only entries because
|
||||
* that would include input tables of aliasless JOINs, NEW/OLD pseudo-entries,
|
||||
* etc.
|
||||
*
|
||||
|
@ -525,7 +525,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
||||
if (cxt->isforeign)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
parser_errposition(cxt->pstate,
|
||||
constraint->location)));
|
||||
cxt->ckconstraints = lappend(cxt->ckconstraints, constraint);
|
||||
@ -536,7 +536,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
||||
if (cxt->isforeign)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
parser_errposition(cxt->pstate,
|
||||
constraint->location)));
|
||||
if (constraint->keys == NIL)
|
||||
@ -553,9 +553,10 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
|
||||
if (cxt->isforeign)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
errmsg("constraints are not supported on foreign tables"),
|
||||
parser_errposition(cxt->pstate,
|
||||
constraint->location)));
|
||||
|
||||
/*
|
||||
* Fill in the current attribute's name and throw it into the
|
||||
* list of FK constraints to be processed later.
|
||||
@ -718,7 +719,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
|
||||
constr = tupleDesc->constr;
|
||||
|
||||
/*
|
||||
* Initialize column number map for map_variable_attnos(). We need this
|
||||
* Initialize column number map for map_variable_attnos(). We need this
|
||||
* since dropped columns in the source table aren't copied, so the new
|
||||
* table can have different column numbers.
|
||||
*/
|
||||
@ -1273,8 +1274,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot convert whole-row table reference"),
|
||||
errdetail("Index \"%s\" contains a whole-row table reference.",
|
||||
RelationGetRelationName(source_idx))));
|
||||
errdetail("Index \"%s\" contains a whole-row table reference.",
|
||||
RelationGetRelationName(source_idx))));
|
||||
|
||||
index->whereClause = pred_tree;
|
||||
}
|
||||
@ -1405,8 +1406,8 @@ transformIndexConstraints(CreateStmtContext *cxt)
|
||||
/*
|
||||
* Scan the index list and remove any redundant index specifications. This
|
||||
* can happen if, for instance, the user writes UNIQUE PRIMARY KEY. A
|
||||
* strict reading of SQL would suggest raising an error instead, but
|
||||
* that strikes me as too anal-retentive. - tgl 2001-02-14
|
||||
* strict reading of SQL would suggest raising an error instead, but that
|
||||
* strikes me as too anal-retentive. - tgl 2001-02-14
|
||||
*
|
||||
* XXX in ALTER TABLE case, it'd be nice to look for duplicate
|
||||
* pre-existing indexes, too.
|
||||
|
Reference in New Issue
Block a user