1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

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

This commit is contained in:
unknown
2004-07-26 10:52:40 +02:00
parent 688089a213
commit 65ba6aa293
3 changed files with 24 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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; };