aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_func.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-05-12 20:10:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-05-12 20:10:05 +0000
commitf9e4f611a18f64fd9106a72ec9af9e2220075780 (patch)
treebfbc1d3d9fb5a008d8fe3405dce3366659c7e7cc /src/backend/parser/parse_func.c
parent71009354c848964e657e540e24dac6b4c9a81570 (diff)
downloadpostgresql-f9e4f611a18f64fd9106a72ec9af9e2220075780.tar.gz
postgresql-f9e4f611a18f64fd9106a72ec9af9e2220075780.zip
First pass at set-returning-functions in FROM, by Joe Conway with
some kibitzing from Tom Lane. Not everything works yet, and there's no documentation or regression test, but let's commit this so Joe doesn't need to cope with tracking changes in so many files ...
Diffstat (limited to 'src/backend/parser/parse_func.c')
-rw-r--r--src/backend/parser/parse_func.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index f74f5be2f7b..339577f39ca 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.127 2002/05/03 20:15:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.128 2002/05/12 20:10:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -181,27 +181,32 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
* sizeof(Pointer) to signal that the runtime representation
* will be a pointer not an Oid.
*/
- if (rte->rtekind != RTE_RELATION)
+ switch (rte->rtekind)
{
- /*
- * RTE is a join or subselect; must fail for lack of a
- * named tuple type
- */
- if (is_column)
- elog(ERROR, "No such attribute %s.%s",
- refname, strVal(lfirst(funcname)));
- else
- {
- elog(ERROR, "Cannot pass result of sub-select or join %s to a function",
- refname);
- }
+ case RTE_RELATION:
+ toid = get_rel_type_id(rte->relid);
+ if (!OidIsValid(toid))
+ elog(ERROR, "Cannot find type OID for relation %u",
+ rte->relid);
+ break;
+ case RTE_FUNCTION:
+ toid = exprType(rte->funcexpr);
+ break;
+ default:
+ /*
+ * RTE is a join or subselect; must fail for lack of a
+ * named tuple type
+ */
+ if (is_column)
+ elog(ERROR, "No such attribute %s.%s",
+ refname, strVal(lfirst(funcname)));
+ else
+ elog(ERROR, "Cannot pass result of sub-select or join %s to a function",
+ refname);
+ toid = InvalidOid; /* keep compiler quiet */
+ break;
}
- toid = get_rel_type_id(rte->relid);
- if (!OidIsValid(toid))
- elog(ERROR, "Cannot find type OID for relation %u",
- rte->relid);
-
/* replace RangeVar in the arg list */
lfirst(i) = makeVar(vnum,
InvalidAttrNumber,