@@ -506,7 +506,7 @@ WithTable
506506/* SELECT */
507507
508508Select
509- : SelectClause RemoveClause? IntoClause FromClause PivotClause? WhereClause GroupClause OrderClause LimitClause UnionClause
509+ : SelectClause RemoveClause? IntoClause FromClause PivotClause? WhereClause GroupClause UnionClause OrderClause LimitClause
510510 {
511511 yy .extend ($$ ,$1 ); yy .extend ($$ ,$2 ); yy .extend ($$ ,$3 ); yy .extend ($$ ,$4 );
512512 yy .extend ($$ ,$5 ); yy .extend ($$ ,$6 );yy .extend ($$ ,$7 );
@@ -524,6 +524,16 @@ Select
524524 }
525525 ;
526526
527+ SelectWithoutOrderOrLimit
528+ : SelectClause RemoveClause? IntoClause FromClause PivotClause? WhereClause GroupClause UnionClause
529+ {
530+ yy .extend ($$ ,$1 ); yy .extend ($$ ,$2 ); yy .extend ($$ ,$3 ); yy .extend ($$ ,$4 );
531+ yy .extend ($$ ,$5 ); yy .extend ($$ ,$6 );yy .extend ($$ ,$7 );yy .extend ($$ ,$8 );
532+ $$ = $1 ;
533+ if (yy .exists ) $$ .exists = yy .exists .slice ();
534+ }
535+ ;
536+
527537PivotClause
528538 : PIVOT LPAR Expression FOR Literal PivotClause2? RPAR AsLiteral?
529539 { $$ = {pivot: {expr: $3 , columnid: $5 , inlist: $6 , as: $8 }}; }
@@ -1074,21 +1084,21 @@ HavingClause
10741084
10751085UnionClause
10761086 : { $$ = undefined ; }
1077- | UNION Select
1087+ | UNION SelectWithoutOrderOrLimit
10781088 { $$ = {union: $2 } ; }
1079- | UNION ALL Select
1089+ | UNION ALL SelectWithoutOrderOrLimit
10801090 { $$ = {unionall: $3 } ; }
1081- | EXCEPT Select
1091+ | EXCEPT SelectWithoutOrderOrLimit
10821092 { $$ = {except: $2 } ; }
1083- | INTERSECT Select
1093+ | INTERSECT SelectWithoutOrderOrLimit
10841094 { $$ = {intersect: $2 } ; }
1085- | UNION CORRESPONDING Select
1095+ | UNION CORRESPONDING SelectWithoutOrderOrLimit
10861096 { $$ = {union: $3 , corresponding: true } ; }
1087- | UNION ALL CORRESPONDING Select
1097+ | UNION ALL CORRESPONDING SelectWithoutOrderOrLimit
10881098 { $$ = {unionall: $4 , corresponding: true } ; }
1089- | EXCEPT CORRESPONDING Select
1099+ | EXCEPT CORRESPONDING SelectWithoutOrderOrLimit
10901100 { $$ = {except: $3 , corresponding: true } ; }
1091- | INTERSECT CORRESPONDING Select
1101+ | INTERSECT CORRESPONDING SelectWithoutOrderOrLimit
10921102 { $$ = {intersect: $3 , corresponding: true } ; }
10931103 ;
10941104
0 commit comments