1010 *
1111 *
1212 * IDENTIFICATION
13- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.67 1997/11/15 20:57:09 momjian Exp $
13+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.68 1997/11/17 16:37:24 thomas Exp $
1414 *
1515 * HISTORY
1616 * AUTHORDATEMAJOR EVENT
@@ -153,7 +153,9 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
153153
154154%type <list>union_clause, select_list
155155%type <list>join_list
156- %type <sortgroupby>join_using
156+ %type <sortgroupby>
157+ join_using
158+ %type <boolean>opt_union
157159
158160%type <node>position_expr
159161%type <list>extract_list, position_list
@@ -1130,7 +1132,7 @@ FetchStmt:FETCH opt_direction fetch_how_many opt_portal_name
11301132n->direction = $2;
11311133n->howMany = $3;
11321134n->portalname = $4;
1133- n->ismove =true ;
1135+ n->ismove =TRUE ;
11341136$$ = (Node *)n;
11351137}
11361138;
@@ -2097,27 +2099,27 @@ RetrieveStmt: SELECT opt_unique res_target_list2
20972099}
20982100;
20992101
2100- union_clause: UNION select_list { $$ = $2 ; }
2102+ union_clause: UNIONopt_union select_list{ $$ = $3 ; }
21012103| /*EMPTY*/{ $$ = NIL; }
21022104;
21032105
2104- select_list: select_list UNION SubSelect
2105- { $$ = lappend($1, $3 ); }
2106+ select_list: select_list UNIONopt_union SubSelect
2107+ { $$ = lappend($1, $4 ); }
21062108| SubSelect
21072109{ $$ = lcons($1, NIL); }
21082110;
21092111
21102112SubSelect:SELECT opt_unique res_target_list2
2111- result from_clause where_clause
2113+ from_clause where_clause
21122114 group_clause having_clause
21132115{
21142116SubSelect *n = makeNode(SubSelect);
21152117n->unique = $2;
21162118n->targetList = $3;
2117- n->fromClause = $5 ;
2118- n->whereClause = $6 ;
2119- n->groupClause = $7 ;
2120- n->havingClause = $8 ;
2119+ n->fromClause = $4 ;
2120+ n->whereClause = $5 ;
2121+ n->groupClause = $6 ;
2122+ n->havingClause = $7 ;
21212123$$ = (Node *)n;
21222124}
21232125;
@@ -2128,9 +2130,14 @@ result: INTO TABLE relation_name
21282130{ $$ = NULL; }
21292131;
21302132
2133+ opt_union: ALL{ $$ = TRUE; }
2134+ | /*EMPTY*/{ $$ = FALSE; }
2135+ ;
2136+
21312137opt_unique: DISTINCT{ $$ = "*"; }
21322138| DISTINCT ON ColId{ $$ = $3; }
2133- | /*EMPTY*/{ $$ = NULL;}
2139+ | ALL{ $$ = NULL; }
2140+ | /*EMPTY*/{ $$ = NULL; }
21342141;
21352142
21362143sort_clause: ORDER BY sortby_list{ $$ = $3; }
@@ -3416,6 +3423,14 @@ AexprConst: Iconst
34163423n->val.val.str = $1;
34173424$$ = (Node *)n;
34183425}
3426+ | Typename Sconst
3427+ {
3428+ A_Const *n = makeNode(A_Const);
3429+ n->typename = $1;
3430+ n->val.type = T_String;
3431+ n->val.val.str = $2;
3432+ $$ = (Node *)n;
3433+ }
34193434| ParamNo
34203435{$$ = (Node *)$1; }
34213436| TRUE_P