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

Commit1e4c050

Browse files
committed
Add a very specific hint for the case that we're unable to locate a function
matching a call like f(x, ORDER BY y,z). It could be that what the userreally wants is f(x,z ORDER BY y). We now have pretty conclusive evidencethat many people won't understand this problem without concrete guidance,so give it to them. Per further discussion of the string_agg() problem.
1 parent2e6dc53 commit1e4c050

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.225 2010/07/29 23:16:33 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.226 2010/08/05 21:45:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -284,6 +284,19 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
284284
errhint("Could not choose a best candidate function. "
285285
"You might need to add explicit type casts."),
286286
parser_errposition(pstate,location)));
287+
elseif (list_length(agg_order)>1)
288+
{
289+
/* It's agg(x, ORDER BY y,z) ... perhaps misplaced ORDER BY */
290+
ereport(ERROR,
291+
(errcode(ERRCODE_UNDEFINED_FUNCTION),
292+
errmsg("function %s does not exist",
293+
func_signature_string(funcname,nargs,argnames,
294+
actual_arg_types)),
295+
errhint("No aggregate function matches the given name and argument types. "
296+
"Perhaps you misplaced ORDER BY; ORDER BY must appear "
297+
"after all regular arguments of the aggregate."),
298+
parser_errposition(pstate,location)));
299+
}
287300
else
288301
ereport(ERROR,
289302
(errcode(ERRCODE_UNDEFINED_FUNCTION),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp