Commit 65ba6aa2 authored by unknown's avatar unknown
Browse files

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

parent 688089a2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
+11 −0
Original line number Diff line number Diff line
@@ -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;
+7 −1
Original line number Diff line number Diff line
@@ -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; };