summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy25
1 files changed, 23 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 635896c2ab2..fbfa42c0b5e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -109,6 +109,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token COUNT_SYM
%token CREATE
%token CROSS
+%token CUBE
%token DELETE_SYM
%token DO_SYM
%token DROP
@@ -130,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token REPLICATION
%token RESET_SYM
%token ROLLBACK_SYM
+%token ROLLUP
%token SELECT_SYM
%token SHOW
%token SLAVE
@@ -2160,7 +2162,7 @@ opt_escape:
group_clause:
/* empty */
- | GROUP BY group_list;
+ | GROUP BY group_list olap_opt;
group_list:
group_list ',' order_ident order_dir
@@ -2168,6 +2170,19 @@ group_list:
| order_ident order_dir
{ if (add_group_to_list($1,(bool) $2)) YYABORT; };
+olap_opt:
+ /* empty */ {}
+ | WITH CUBE
+ {
+ Lex->olap = true;
+ Select->olap= CUBE_TYPE;
+ }
+ | WITH ROLLUP
+ {
+ Lex->olap = true;
+ Select->olap= ROLLUP_TYPE;
+ }
+
/*
Order by statement in select
*/
@@ -2180,7 +2195,7 @@ order_clause:
ORDER_SYM BY
{
LEX *lex=Lex;
- if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ if (lex->sql_command == SQLCOM_MULTI_UPDATE || lex->olap)
YYABORT;
lex->select->sort_default=1;
} order_list;
@@ -2201,12 +2216,16 @@ limit_clause:
/* empty */ {}
| LIMIT ULONG_NUM
{
+ if (Lex->olap)
+ YYABORT;
SELECT_LEX *sel=Select;
sel->select_limit= $2;
sel->offset_limit=0L;
}
| LIMIT ULONG_NUM ',' ULONG_NUM
{
+ if (Lex->olap)
+ YYABORT;
SELECT_LEX *sel=Select;
sel->select_limit= $4; sel->offset_limit=$2;
};
@@ -3011,6 +3030,7 @@ keyword:
| COMMIT_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
+ | CUBE {}
| DATA_SYM {}
| DATETIME {}
| DATE_SYM {}
@@ -3104,6 +3124,7 @@ keyword:
| RESOURCES {}
| RESTORE_SYM {}
| ROLLBACK_SYM {}
+ | ROLLUP {}
| ROWS_SYM {}
| ROW_FORMAT_SYM {}
| ROW_SYM {}