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

Commit7f02049

Browse files
committed
Give a more reasonable error message for a bad attribute name applied
to a join or subselect alias ... cf. Oliver Elphick's complaint 13-Mar.
1 parent2736ad3 commit7f02049

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 18 additions & 6 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_func.c,v 1.99 2001/02/1421:35:04 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.100 2001/03/1423:55:33 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -319,7 +319,8 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
319319
* A projection must match an attribute name of the rel.
320320
*/
321321
if (get_attnum(argrelid,funcname)==InvalidAttrNumber)
322-
elog(ERROR,"Functions on sets are not yet supported");
322+
elog(ERROR,"No such attribute or function '%s'",
323+
funcname);
323324
}
324325

325326
if (retval)
@@ -448,8 +449,15 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
448449
}
449450
elseif (IsA(rteorjoin,JoinExpr))
450451
{
451-
elog(ERROR,
452-
"function applied to tuple is not supported for joins");
452+
/*
453+
* We have f(x) or more likely x.f where x is a join and f
454+
* is not one of the attribute names of the join (else we'd
455+
* have recognized it above). We don't support functions on
456+
* join tuples (since we don't have a named type for the join
457+
* tuples), so error out.
458+
*/
459+
elog(ERROR,"No such attribute or function %s.%s",
460+
refname,funcname);
453461
rte=NULL;/* keep compiler quiet */
454462
}
455463
else
@@ -471,8 +479,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
471479
* not an Oid.
472480
*/
473481
if (rte->relname==NULL)
474-
elog(ERROR,
475-
"function applied to tuple is not supported for subSELECTs");
482+
{
483+
/* Here, we have an unrecognized attribute of a sub-select */
484+
elog(ERROR,"No such attribute or function %s.%s",
485+
refname,funcname);
486+
}
487+
476488
toid=typenameTypeId(rte->relname);
477489

478490
/* replace it in the arg list */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp