Bug#43385 Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist
allow 'rename view' for ALTER ...UPGRADE DATA DIRECTORY NAME command. it's safe because a view has valid internal db&table names in this case. mysql-test/r/upgrade.result: test result mysql-test/t/upgrade.test: test case sql/sql_rename.cc: allow 'rename view' for ALTER ...UPGRADE DATA DIRECTORY NAME command. it's safe because a view has valid internal db&table names in this case.
This commit is contained in:
parent
214bd5a121
commit
bb08984f07
@ -84,3 +84,23 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin2
|
||||
drop database `a-b-c`;
|
||||
drop database `tabc`;
|
||||
use `#mysql50#a-b-c`;
|
||||
create table t1(f1 char(10));
|
||||
show databases like '%a-b-c%';
|
||||
Database (%a-b-c%)
|
||||
#mysql50#a-b-c
|
||||
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
|
||||
show databases like '%a-b-c%';
|
||||
Database (%a-b-c%)
|
||||
a-b-c
|
||||
show create view `a-b-c`.v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci
|
||||
Warnings:
|
||||
Note 1600 Creation context of view `a-b-c`.`v1' is invalid
|
||||
select * from `a-b-c`.v1;
|
||||
f1
|
||||
Warnings:
|
||||
Note 1600 Creation context of view `a-b-c`.`v1' is invalid
|
||||
drop database `a-b-c`;
|
||||
use test;
|
||||
|
@ -89,3 +89,33 @@ show create table `a-b-c`.`t1`;
|
||||
drop database `a-b-c`;
|
||||
drop database `tabc`;
|
||||
|
||||
#
|
||||
# Bug#43385 Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist
|
||||
#
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--mkdir $MYSQLD_DATADIR/a-b-c
|
||||
use `#mysql50#a-b-c`;
|
||||
create table t1(f1 char(10));
|
||||
|
||||
--write_file $MYSQLD_DATADIR/a-b-c/v1.frm
|
||||
TYPE=VIEW
|
||||
query=select `a`.`f1` AS `f1` from `a-b-c`.`t1` `a` join `information_schema`.`tables` `b` where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`)
|
||||
md5=068271f1c657fe115e497856ca0fa493
|
||||
updatable=0
|
||||
algorithm=0
|
||||
definer_user=root
|
||||
definer_host=localhost
|
||||
suid=2
|
||||
with_check_option=0
|
||||
timestamp=2009-04-10 11:53:37
|
||||
create-version=1
|
||||
source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name
|
||||
EOF
|
||||
|
||||
show databases like '%a-b-c%';
|
||||
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
|
||||
show databases like '%a-b-c%';
|
||||
show create view `a-b-c`.v1;
|
||||
select * from `a-b-c`.v1;
|
||||
drop database `a-b-c`;
|
||||
use test;
|
||||
|
@ -301,8 +301,13 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
|
||||
}
|
||||
break;
|
||||
case FRMTYPE_VIEW:
|
||||
/* change of schema is not allowed */
|
||||
if (strcmp(ren_table->db, new_db))
|
||||
/*
|
||||
change of schema is not allowed
|
||||
except of ALTER ...UPGRADE DATA DIRECTORY NAME command
|
||||
because a view has valid internal db&table names in this case.
|
||||
*/
|
||||
if (thd->lex->sql_command != SQLCOM_ALTER_DB_UPGRADE &&
|
||||
strcmp(ren_table->db, new_db))
|
||||
my_error(ER_FORBID_SCHEMA_CHANGE, MYF(0), ren_table->db,
|
||||
new_db);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user