Commit b9512a55 authored by serg@serg.mylan's avatar serg@serg.mylan

BUG#4717 - check for valid table names in ALTER TABLE ... RENAME

parent a0bae8eb
......@@ -380,3 +380,9 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
create table t1 (a int);
alter table t1 rename to `t1\\`;
Incorrect table name 't1\\'
rename table t1 to `t1\\`;
Incorrect table name 't1\\'
drop table t1;
......@@ -243,3 +243,14 @@ LOCK TABLES t1 WRITE;
ALTER TABLE t1 DISABLE KEYS;
SHOW INDEX FROM t1;
DROP TABLE t1;
#
# BUG#4717 - check for valid table names
#
create table t1 (a int);
--error 1103
alter table t1 rename to `t1\\`;
--error 1103
rename table t1 to `t1\\`;
drop table t1;
......@@ -1316,10 +1316,16 @@ alter_list_item:
lex->simple_alter=0;
}
| RENAME opt_to table_ident
{
{
LEX *lex=Lex;
lex->select->db=$3->db.str;
lex->name= $3->table.str;
if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str))
{
net_printf(&lex->thd->net,ER_WRONG_TABLE_NAME,$3->table.str);
YYABORT;
}
}
| create_table_options { Lex->simple_alter=0; }
| order_clause { Lex->simple_alter=0; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment