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.yy36
1 files changed, 34 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bd0014f4764..8f135e63113 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1145,6 +1145,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token MULTIPOINT
%token MULTIPOLYGON
%token MUTEX_SYM
+%token MYSQL_SYM
%token MYSQL_ERRNO_SYM
%token NAMES_SYM /* SQL-2003-N */
%token NAME_SYM /* SQL-2003-N */
@@ -7191,7 +7192,7 @@ opt_checksum_type:
;
repair:
- REPAIR opt_no_write_to_binlog table_or_tables
+ REPAIR opt_no_write_to_binlog table_or_view
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_REPAIR;
@@ -7204,6 +7205,15 @@ repair:
table_list opt_mi_repair_type
{
LEX* lex= thd->lex;
+ if ((lex->only_view &&
+ ((lex->check_opt.flags & (T_QUICK | T_EXTEND)) ||
+ (lex->check_opt.sql_flags & TT_USEFRM))) ||
+ (!lex->only_view &&
+ (lex->check_opt.sql_flags & TT_FROM_MYSQL)))
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
DBUG_ASSERT(!lex->m_stmt);
lex->m_stmt= new (thd->mem_root) Repair_table_statement(lex);
if (lex->m_stmt == NULL)
@@ -7225,6 +7235,7 @@ mi_repair_type:
QUICK { Lex->check_opt.flags|= T_QUICK; }
| EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; }
| USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; }
+ | FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; }
;
analyze:
@@ -7257,7 +7268,7 @@ binlog_base64_event:
;
check:
- CHECK_SYM table_or_tables
+ CHECK_SYM table_or_view
{
LEX *lex=Lex;
@@ -7275,6 +7286,13 @@ check:
table_list opt_mi_check_type
{
LEX* lex= thd->lex;
+ if (lex->only_view &&
+ (lex->check_opt.flags & (T_QUICK | T_FAST | T_EXTEND |
+ T_CHECK_ONLY_CHANGED)))
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
DBUG_ASSERT(!lex->m_stmt);
lex->m_stmt= new (thd->mem_root) Check_table_statement(lex);
if (lex->m_stmt == NULL)
@@ -7382,6 +7400,7 @@ keycache:
LEX *lex=Lex;
lex->sql_command= SQLCOM_ASSIGN_TO_KEYCACHE;
lex->ident= $6;
+ lex->only_view= FALSE;
}
;
@@ -7426,6 +7445,7 @@ preload:
LEX *lex=Lex;
lex->sql_command=SQLCOM_PRELOAD_KEYS;
lex->alter_info.reset();
+ lex->only_view= FALSE;
}
preload_list_or_parts
{}
@@ -13187,6 +13207,7 @@ keyword_sp:
| MULTIPOINT {}
| MULTIPOLYGON {}
| MUTEX_SYM {}
+ | MYSQL_SYM {}
| MYSQL_ERRNO_SYM {}
| NAME_SYM {}
| NAMES_SYM {}
@@ -13786,7 +13807,18 @@ lock:
table_or_tables:
TABLE_SYM
+ { Lex->only_view= FALSE; }
+ | TABLES
+ { Lex->only_view= FALSE; }
+ ;
+
+table_or_view:
+ TABLE_SYM
+ { Lex->only_view= FALSE; }
| TABLES
+ { Lex->only_view= FALSE; }
+ | VIEW_SYM
+ { Lex->only_view= TRUE; }
;
table_lock_list: