diff options
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r-- | src/backend/parser/analyze.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 7c553f3625f..05a1ecf3352 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.55 1997/12/23 19:39:42 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.56 1997/12/24 06:06:18 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -821,18 +821,7 @@ transformSelectStmt(ParseState *pstate, RetrieveStmt *stmt) /* fix where clause */ qry->qual = transformWhereClause(pstate, stmt->whereClause); - /* check subselect clause */ - if (stmt->unionClause) - { - elog(NOTICE, "UNION not yet supported; using first SELECT only", NULL); - - /* XXX HACK just playing with union clause - thomas 1997-12-19 */ - if ((qry->uniqueFlag == NULL) - && (! ((SubSelect *)lfirst(stmt->unionClause))->unionall)) - qry->uniqueFlag = "*"; - } - - /* check subselect clause */ + /* check having clause */ if (stmt->havingClause) elog(NOTICE, "HAVING not yet supported; ignore clause", NULL); @@ -842,7 +831,6 @@ transformSelectStmt(ParseState *pstate, RetrieveStmt *stmt) qry->targetList, qry->uniqueFlag); - /* fix group by clause */ qry->groupClause = transformGroupClause(pstate, stmt->groupClause, qry->targetList); @@ -851,6 +839,20 @@ transformSelectStmt(ParseState *pstate, RetrieveStmt *stmt) if (pstate->p_numAgg > 0) finalizeAggregates(pstate, qry); + if (stmt->unionClause) + { + List *ulist = NIL; + QueryTreeList *qlist; + int i; + + qlist = parse_analyze(stmt->unionClause); + for (i=0; i < qlist->len; i++) + ulist = lappend(ulist, qlist->qtrees[i]); + qry->unionClause = ulist; + } + else + qry->unionClause = NULL; + return (Query *) qry; } |