diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-14 23:55:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-14 23:55:33 +0000 |
commit | 7f0204913713da8ebb54bf0350bd652d58bbf26f (patch) | |
tree | c52d5cbabc469241700dcf732908319f3afe5ff4 /src | |
parent | 2736ad31dc68bc3294bb6c9d1a56c424d62bf2b5 (diff) | |
download | postgresql-7f0204913713da8ebb54bf0350bd652d58bbf26f.tar.gz postgresql-7f0204913713da8ebb54bf0350bd652d58bbf26f.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/parse_func.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index e0d2b515526..bece816a7f4 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.99 2001/02/14 21:35:04 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.100 2001/03/14 23:55:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -319,7 +319,8 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, * A projection must match an attribute name of the rel. */ if (get_attnum(argrelid, funcname) == InvalidAttrNumber) - elog(ERROR, "Functions on sets are not yet supported"); + elog(ERROR, "No such attribute or function '%s'", + funcname); } if (retval) @@ -448,8 +449,15 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, } else if (IsA(rteorjoin, JoinExpr)) { - elog(ERROR, - "function applied to tuple is not supported for joins"); + /* + * We have f(x) or more likely x.f where x is a join and f + * is not one of the attribute names of the join (else we'd + * have recognized it above). We don't support functions on + * join tuples (since we don't have a named type for the join + * tuples), so error out. + */ + elog(ERROR, "No such attribute or function %s.%s", + refname, funcname); rte = NULL; /* keep compiler quiet */ } else @@ -471,8 +479,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, * not an Oid. */ if (rte->relname == NULL) - elog(ERROR, - "function applied to tuple is not supported for subSELECTs"); + { + /* Here, we have an unrecognized attribute of a sub-select */ + elog(ERROR, "No such attribute or function %s.%s", + refname, funcname); + } + toid = typenameTypeId(rte->relname); /* replace it in the arg list */ |