Loading mysql-test/r/alter_table.result +6 −0 Original line number Diff line number Diff line Loading @@ -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; mysql-test/t/alter_table.test +11 −0 Original line number Diff line number Diff line Loading @@ -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; sql/sql_yacc.yy +7 −1 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,12 @@ alter_list_item: 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; }; Loading Loading
mysql-test/r/alter_table.result +6 −0 Original line number Diff line number Diff line Loading @@ -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;
mysql-test/t/alter_table.test +11 −0 Original line number Diff line number Diff line Loading @@ -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;
sql/sql_yacc.yy +7 −1 Original line number Diff line number Diff line Loading @@ -1320,6 +1320,12 @@ alter_list_item: 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; }; Loading