From f065957062095f1b563d91b8950ee7411055025c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 30 Sep 2004 00:24:27 +0000 Subject: Come to think of it, functions in FROM have the same syntactic restriction as CREATE INDEX did, and can be fixed the same way, for another small improvement in usability and reduction in grammar size. --- src/backend/parser/parse_clause.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/backend/parser/parse_clause.c') diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index a0dd961363d..af3cbffa700 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.136 2004/08/29 05:06:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.137 2004/09/30 00:24:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -497,12 +497,16 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) RangeTblEntry *rte; RangeTblRef *rtr; - /* Get function name for possible use as alias */ - Assert(IsA(r->funccallnode, FuncCall)); - funcname = strVal(llast(((FuncCall *) r->funccallnode)->funcname)); + /* + * Get function name for possible use as alias. We use the same + * transformation rules as for a SELECT output expression. For a + * FuncCall node, the result will be the function name, but it is + * possible for the grammar to hand back other node types. + */ + funcname = FigureColname(r->funccallnode); /* - * Transform the raw FuncCall node. + * Transform the raw expression. */ funcexpr = transformExpr(pstate, r->funccallnode); -- cgit v1.2.3