diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/create.result | 8 | ||||
-rw-r--r-- | mysql-test/r/query_cache.result | 49 | ||||
-rw-r--r-- | mysql-test/r/renamedb.result | 43 | ||||
-rw-r--r-- | mysql-test/r/sp-code.result | 4 | ||||
-rw-r--r-- | mysql-test/r/sp-error.result | 13 | ||||
-rw-r--r-- | mysql-test/r/upgrade.result | 25 | ||||
-rw-r--r-- | mysql-test/t/create.test | 19 | ||||
-rw-r--r-- | mysql-test/t/query_cache.test | 80 | ||||
-rw-r--r-- | mysql-test/t/renamedb.test | 71 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 28 | ||||
-rw-r--r-- | mysql-test/t/upgrade.test | 31 |
11 files changed, 209 insertions, 162 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 84a620336dc..82bcc68f319 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1588,14 +1588,6 @@ CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a; -ERROR 42000: Unknown database 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -create database mysqltest; -RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -drop database mysqltest; USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 321b08628ee..5a15a87bd3c 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1684,52 +1684,3 @@ set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size=default; End of 5.0 tests -drop database if exists db1; -drop database if exists db2; -set GLOBAL query_cache_size=15*1024*1024; -create database db1; -use db1; -create table t1(c1 int)engine=myisam; -insert into t1(c1) values (1); -select * from db1.t1 f; -c1 -1 -show status like 'Qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 1 -rename schema db1 to db2; -show status like 'Qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 0 -drop database db2; -set global query_cache_size=default; -drop database if exists db1; -drop database if exists db3; -set GLOBAL query_cache_size=15*1024*1024; -create database db1; -create database db3; -use db1; -create table t1(c1 int) engine=myisam; -use db3; -create table t1(c1 int) engine=myisam; -use db1; -insert into t1(c1) values (1); -use mysql; -select * from db1.t1; -c1 -1 -select c1+1 from db1.t1; -c1+1 -2 -select * from db3.t1; -c1 -show status like 'Qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 3 -rename schema db1 to db2; -show status like 'Qcache_queries_in_cache'; -Variable_name Value -Qcache_queries_in_cache 1 -drop database db2; -drop database db3; -End of 5.1 tests diff --git a/mysql-test/r/renamedb.result b/mysql-test/r/renamedb.result index b22322fbe8d..ff8f89592fc 100644 --- a/mysql-test/r/renamedb.result +++ b/mysql-test/r/renamedb.result @@ -1,33 +1,12 @@ -drop database if exists testdb1; -create database testdb1 default character set latin2; -use testdb1; -create table t1 (a int); -insert into t1 values (1),(2),(3); -show create database testdb1; -Database Create Database -testdb1 CREATE DATABASE `testdb1` /*!40100 DEFAULT CHARACTER SET latin2 */ -show tables; -Tables_in_testdb1 -t1 rename database testdb1 to testdb2; -show create database testdb1; -ERROR 42000: Unknown database 'testdb1' -show create database testdb2; -Database Create Database -testdb2 CREATE DATABASE `testdb2` /*!40100 DEFAULT CHARACTER SET latin2 */ -select database(); -database() -testdb2 -show tables; -Tables_in_testdb2 -t1 -select a from t1 order by a; -a -1 -2 -3 -drop database testdb2; -create database testdb1; -rename database testdb1 to testdb1; -ERROR HY000: Can't create database 'testdb1'; database exists -drop database testdb1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database testdb1 to testdb2' at line 1 +ALTER DATABASE wrong UPGRADE DATA DIRECTORY NAME; +ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name +ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME; +ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name +ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME; +ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name +ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME; +ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +ERROR 42000: Unknown database '#mysql50#upgrade-me' diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index b2bcfff0fdb..018173e723d 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -155,11 +155,11 @@ Pos Instruction 0 stmt 9 "drop temporary table if exists sudoku..." 1 stmt 1 "create temporary table sudoku_work ( ..." 2 stmt 1 "create temporary table sudoku_schedul..." -3 stmt 95 "call sudoku_init()" +3 stmt 94 "call sudoku_init()" 4 jump_if_not 7(8) p_naive@0 5 stmt 4 "update sudoku_work set cnt = 0 where ..." 6 jump 8 -7 stmt 95 "call sudoku_count()" +7 stmt 94 "call sudoku_count()" 8 stmt 6 "insert into sudoku_schedule (row,col)..." 9 set v_scounter@2 0 10 set v_i@3 1 diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 2e0d437aeb6..bfcd64e89d3 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1478,3 +1478,16 @@ end until true end repeat retry; end// ERROR 42000: LEAVE with no matching label: retry +drop procedure if exists proc_28360; +drop function if exists func_28360; +CREATE PROCEDURE proc_28360() +BEGIN +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +END// +ERROR HY000: Can't drop or alter a DATABASE from within another stored routine +CREATE FUNCTION func_28360() RETURNS int +BEGIN +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +RETURN 0; +END// +ERROR HY000: Can't drop or alter a DATABASE from within another stored routine diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index 76e0359c405..adf81efe8e3 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -59,3 +59,28 @@ drop table `txu@0023p@0023p1`; drop table `txu#p#p1`; truncate t1; drop table t1; +drop database if exists `tabc`; +drop database if exists `a-b-c`; +create database `tabc` default character set latin2; +create table tabc.t1 (a int); +FLUSH TABLES; +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 database `a-b-c`; +Database Create Database +a-b-c CREATE DATABASE `a-b-c` /*!40100 DEFAULT CHARACTER SET latin2 */ +show tables in `a-b-c`; +Tables_in_a-b-c +t1 +show create table `a-b-c`.`t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin2 +drop database `a-b-c`; +drop database `tabc`; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 341c019af6e..d4feeebe4b1 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1197,14 +1197,17 @@ drop table t1,t2; CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; --error 1102 DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ---error 1049 -RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a; ---error 1102 -RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -create database mysqltest; ---error 1102 -RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -drop database mysqltest; + +# TODO: enable these tests when RENAME DATABASE is implemented. +# --error 1049 +# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a; +# --error 1102 +# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +# create database mysqltest; +# --error 1102 +# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +# drop database mysqltest; + --error 1102 USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; --error 1102 diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index d06698cdb17..2cfe1ff4ccc 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -1293,44 +1293,42 @@ set GLOBAL query_cache_size=default; # # Bug #28211 RENAME DATABASE and query cache don't play nicely together -# ---disable_warnings -drop database if exists db1; -drop database if exists db2; ---enable_warnings -set GLOBAL query_cache_size=15*1024*1024; -create database db1; -use db1; -create table t1(c1 int)engine=myisam; -insert into t1(c1) values (1); -select * from db1.t1 f; -show status like 'Qcache_queries_in_cache'; -rename schema db1 to db2; -show status like 'Qcache_queries_in_cache'; -drop database db2; -set global query_cache_size=default; - ---disable_warnings -drop database if exists db1; -drop database if exists db3; ---enable_warnings -set GLOBAL query_cache_size=15*1024*1024; -create database db1; -create database db3; -use db1; -create table t1(c1 int) engine=myisam; -use db3; -create table t1(c1 int) engine=myisam; -use db1; -insert into t1(c1) values (1); -use mysql; -select * from db1.t1; -select c1+1 from db1.t1; -select * from db3.t1; -show status like 'Qcache_queries_in_cache'; -rename schema db1 to db2; -show status like 'Qcache_queries_in_cache'; -drop database db2; -drop database db3; - ---echo End of 5.1 tests +# TODO: enable these tests when RENAME DATABASE is implemented. +# --disable_warnings +# drop database if exists db1; +# drop database if exists db2; +# --enable_warnings +# set GLOBAL query_cache_size=15*1024*1024; +# create database db1; +# use db1; +# create table t1(c1 int)engine=myisam; +# insert into t1(c1) values (1); +# select * from db1.t1 f; +# show status like 'Qcache_queries_in_cache'; +# rename schema db1 to db2; +# show status like 'Qcache_queries_in_cache'; +# drop database db2; +# set global query_cache_size=default; +# +# --disable_warnings +# drop database if exists db1; +# drop database if exists db3; +# --enable_warnings +# set GLOBAL query_cache_size=15*1024*1024; +# create database db1; +# create database db3; +# use db1; +# create table t1(c1 int) engine=myisam; +# use db3; +# create table t1(c1 int) engine=myisam; +# use db1; +# insert into t1(c1) values (1); +# use mysql; +# select * from db1.t1; +# select c1+1 from db1.t1; +# select * from db3.t1; +# show status like 'Qcache_queries_in_cache'; +# rename schema db1 to db2; +# show status like 'Qcache_queries_in_cache'; +# drop database db2; +# drop database db3; diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test index 1e71adb3bf3..84315090b7a 100644 --- a/mysql-test/t/renamedb.test +++ b/mysql-test/t/renamedb.test @@ -1,26 +1,53 @@ ---disable_warnings -drop database if exists testdb1; ---enable_warnings - -create database testdb1 default character set latin2; -use testdb1; -create table t1 (a int); -insert into t1 values (1),(2),(3); -show create database testdb1; -show tables; -rename database testdb1 to testdb2; ---error 1049 -show create database testdb1; -show create database testdb2; -select database(); -show tables; -select a from t1 order by a; -drop database testdb2; +# TODO: enable these tests when RENAME DATABASE is implemented. +# +# --disable_warnings +# drop database if exists testdb1; +# --enable_warnings +# +# create database testdb1 default character set latin2; +# use testdb1; +# create table t1 (a int); +# insert into t1 values (1),(2),(3); +# show create database testdb1; +# show tables; +# rename database testdb1 to testdb2; +# --error 1049 +# show create database testdb1; +# show create database testdb2; +# select database(); +# show tables; +# select a from t1 order by a; +# drop database testdb2; +# # # Bug#19392 Rename Database: Crash if case change # -create database testdb1; ---error 1007 -rename database testdb1 to testdb1; -drop database testdb1; +# create database testdb1; +# --error 1007 +# rename database testdb1 to testdb1; +# drop database testdb1; + +# +# WL#4030 (Deprecate RENAME DATABASE: replace with ALTER DATABASE <name> UPGRADE) +# + +--error ER_PARSE_ERROR +rename database testdb1 to testdb2; + +--error ER_WRONG_USAGE +ALTER DATABASE wrong UPGRADE DATA DIRECTORY NAME; + +--error ER_WRONG_USAGE +ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME; + +--error ER_WRONG_USAGE +ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME; + +--error ER_WRONG_USAGE +ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME; + +--error ER_BAD_DB_ERROR +ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; + + diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 012f2b33225..c9145859405 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -2150,6 +2150,34 @@ end// delimiter ;// + +# +# Bug#28360 (RENAME DATABASE destroys routines) +# + +--disable_warnings +drop procedure if exists proc_28360; +drop function if exists func_28360; +--enable_warnings + +delimiter //; + +--error ER_SP_NO_DROP_SP +CREATE PROCEDURE proc_28360() +BEGIN + ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; +END// + +--error ER_SP_NO_DROP_SP +CREATE FUNCTION func_28360() RETURNS int +BEGIN + ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME; + RETURN 0; +END// + +delimiter ;// + + # # BUG#NNNN: New bug synopsis # diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index f517c7787f8..40bd17fc3a5 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -56,3 +56,34 @@ system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLTEST_VARDIR/master-da truncate t1; drop table t1; +# +# Bug#28360 (RENAME DATABASE destroys routines) +# + + +--disable_warnings +drop database if exists `tabc`; +drop database if exists `a-b-c`; +--enable_warnings + +create database `tabc` default character set latin2; +create table tabc.t1 (a int); +FLUSH TABLES; + +# Manually make a 5.0 database from the template +--exec mkdir $MYSQLTEST_VARDIR/master-data/a-b-c +--copy_file $MYSQLTEST_VARDIR/master-data/tabc/db.opt $MYSQLTEST_VARDIR/master-data/a-b-c/db.opt +--copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.frm $MYSQLTEST_VARDIR/master-data/a-b-c/t1.frm +--copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYD $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYD +--copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYI $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYI + +show databases like '%a-b-c%'; +ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME; +# The physical directory name is now a@002db@002dc, the logical name still a-b-c +show databases like '%a-b-c%'; +show create database `a-b-c`; +show tables in `a-b-c`; +show create table `a-b-c`.`t1`; +drop database `a-b-c`; +drop database `tabc`; + |