Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita56ff9a

Browse files
committed
Another round of error message editing, covering backend/parser/.
1 parent0230380 commita56ff9a

37 files changed

+1326
-822
lines changed

‎src/backend/parser/analyze.c

Lines changed: 212 additions & 99 deletions
Large diffs are not rendered by default.

‎src/backend/parser/gram.y

Lines changed: 219 additions & 139 deletions
Large diffs are not rendered by default.

‎src/backend/parser/parse_agg.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.54 2003/07/01 19:10:52 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.55 2003/07/19 20:20:52 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -69,7 +69,9 @@ transformAggregateCall(ParseState *pstate, Aggref *agg)
6969
if (min_varlevel==0)
7070
{
7171
if (checkExprHasAggs((Node*)agg->target))
72-
elog(ERROR,"aggregate function calls may not be nested");
72+
ereport(ERROR,
73+
(errcode(ERRCODE_GROUPING_ERROR),
74+
errmsg("aggregate function calls may not be nested")));
7375
}
7476

7577
if (min_varlevel<0)
@@ -113,9 +115,13 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
113115
* problem is in WHERE.)
114116
*/
115117
if (checkExprHasAggs(qry->jointree->quals))
116-
elog(ERROR,"Aggregates not allowed in WHERE clause");
118+
ereport(ERROR,
119+
(errcode(ERRCODE_GROUPING_ERROR),
120+
errmsg("aggregates not allowed in WHERE clause")));
117121
if (checkExprHasAggs((Node*)qry->jointree->fromlist))
118-
elog(ERROR,"Aggregates not allowed in JOIN conditions");
122+
ereport(ERROR,
123+
(errcode(ERRCODE_GROUPING_ERROR),
124+
errmsg("aggregates not allowed in JOIN conditions")));
119125

120126
/*
121127
* No aggregates allowed in GROUP BY clauses, either.
@@ -134,7 +140,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
134140
if (expr==NULL)
135141
continue;/* probably cannot happen */
136142
if (checkExprHasAggs(expr))
137-
elog(ERROR,"Aggregates not allowed in GROUP BY clause");
143+
ereport(ERROR,
144+
(errcode(ERRCODE_GROUPING_ERROR),
145+
errmsg("aggregates not allowed in GROUP BY clause")));
138146
groupClauses=lcons(expr,groupClauses);
139147
if (!IsA(expr,Var))
140148
have_non_var_grouping= true;
@@ -291,11 +299,15 @@ check_ungrouped_columns_walker(Node *node,
291299
rte=rt_fetch(var->varno,context->pstate->p_rtable);
292300
attname=get_rte_attribute_name(rte,var->varattno);
293301
if (context->sublevels_up==0)
294-
elog(ERROR,"Attribute %s.%s must be GROUPed or used in an aggregate function",
295-
rte->eref->aliasname,attname);
302+
ereport(ERROR,
303+
(errcode(ERRCODE_GROUPING_ERROR),
304+
errmsg("attribute \"%s.%s\" must be GROUPed or used in an aggregate function",
305+
rte->eref->aliasname,attname)));
296306
else
297-
elog(ERROR,"Sub-SELECT uses un-GROUPed attribute %s.%s from outer query",
298-
rte->eref->aliasname,attname);
307+
ereport(ERROR,
308+
(errcode(ERRCODE_GROUPING_ERROR),
309+
errmsg("sub-select uses un-GROUPed attribute \"%s.%s\" from outer query",
310+
rte->eref->aliasname,attname)));
299311

300312
}
301313

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp