mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / upgrade.test
bloba7b9a1531ff1496744d4171ec6f33e858220c763
1 -- source include/not_embedded.inc
3 --disable_warnings
4 drop database if exists `mysqltest1`;
5 drop database if exists `mysqltest-1`;
6 drop database if exists `#mysql50#mysqltest-1`;
7 --enable_warnings
9 create database `mysqltest1`;
10 create database `#mysql50#mysqltest-1`;
11 create table `mysqltest1`.`t1` (a int);
12 create table `mysqltest1`.`#mysql50#t-1` (a int);
13 create table `#mysql50#mysqltest-1`.`t1` (a int);
14 create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
15 show create database `mysqltest1`;
16 --error 1049
17 show create database `mysqltest-1`;
18 show create database `#mysql50#mysqltest-1`;
19 show tables in `mysqltest1`;
20 show tables in `#mysql50#mysqltest-1`;
22 --exec $MYSQL_CHECK --all-databases --fix-db-names --fix-table-names
24 show create database `mysqltest1`;
25 show create database `mysqltest-1`;
26 --error 1049
27 show create database `#mysql50#mysqltest-1`;
28 show tables in `mysqltest1`;
29 show tables in `mysqltest-1`;
30 drop database `mysqltest1`;
31 drop database `mysqltest-1`;
34 # Bug#17142: Crash if create with encoded name
36 --disable_warnings
37 drop table if exists `txu@0023p@0023p1`;
38 drop table if exists `txu#p#p1`;
39 --enable_warnings
40 create table `txu#p#p1` (s1 int);
41 insert into `txu#p#p1` values (1);
42 --error 1146
43 select * from `txu@0023p@0023p1`;
44 create table `txu@0023p@0023p1` (s1 int);
45 insert into `txu@0023p@0023p1` values (2);
46 select * from `txu@0023p@0023p1`;
47 select * from `txu#p#p1`;
48 drop table `txu@0023p@0023p1`;
49 drop table `txu#p#p1`;
51 --echo #
52 --echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
53 --echo #
54 --echo # copy table created using mysql4.0 into the data dir
55 let $MYSQLD_DATADIR= `SELECT @@datadir`;
56 copy_file std_data/bug37631.frm $MYSQLD_DATADIR/test/t1.frm;
57 copy_file std_data/bug37631.MYD $MYSQLD_DATADIR/test/t1.MYD;
58 copy_file std_data/bug37631.MYI $MYSQLD_DATADIR/test/t1.MYI;
59 --echo # check the table created using mysql 4.0
60 CHECK TABLE t1;
61 --echo # query the table created using mysql 4.0
62 SELECT * FROM t1;
63 DROP TABLE t1;
66 # Check if old tables work
69 let $MYSQLD_DATADIR= `select @@datadir`;
70 --error 0,1
71 --remove_file $MYSQLD_DATADIR/test/t1.frm
72 --copy_file std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm
73 truncate t1;
74 drop table t1;
77 # Bug#28360 (RENAME DATABASE destroys routines)
80 --disable_warnings
81 drop database if exists `tabc`;
82 drop database if exists `a-b-c`;
83 --enable_warnings
85 create database `tabc` default character set latin2;
86 create table tabc.t1 (a int);
87 FLUSH TABLES;
89 # Manually make a 5.0 database from the template
90 --mkdir $MYSQLD_DATADIR/a-b-c
91 --copy_file $MYSQLD_DATADIR/tabc/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
92 --copy_file $MYSQLD_DATADIR/tabc/t1.frm $MYSQLD_DATADIR/a-b-c/t1.frm
93 --copy_file $MYSQLD_DATADIR/tabc/t1.MYD $MYSQLD_DATADIR/a-b-c/t1.MYD
94 --copy_file $MYSQLD_DATADIR/tabc/t1.MYI $MYSQLD_DATADIR/a-b-c/t1.MYI
96 show databases like '%a-b-c%';
97 ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
98 # The physical directory name is now a@002db@002dc, the logical name still a-b-c
99 show databases like '%a-b-c%';
100 show create database `a-b-c`;
101 show tables in `a-b-c`;
102 show create table `a-b-c`.`t1`;
103 drop database `a-b-c`;
104 drop database `tabc`;
107 # Bug#43385 Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist
109 let $MYSQLD_DATADIR= `select @@datadir`;
110 --mkdir $MYSQLD_DATADIR/a-b-c
111 use `#mysql50#a-b-c`;
112 create table t1(f1 char(10));
114 --write_file $MYSQLD_DATADIR/a-b-c/v1.frm
115 TYPE=VIEW
116 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`)
117 md5=068271f1c657fe115e497856ca0fa493
118 updatable=0
119 algorithm=0
120 definer_user=root
121 definer_host=localhost
122 suid=2
123 with_check_option=0
124 timestamp=2009-04-10 11:53:37
125 create-version=1
126 source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name
127 client_cs_name=utf8
128 connection_cl_name=utf8_general_ci
131 show databases like '%a-b-c%';
132 ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
133 show databases like '%a-b-c%';
134 show create view `a-b-c`.v1;
135 --disable_ps_protocol
136 select * from `a-b-c`.v1;
137 --enable_ps_protocol
138 drop database `a-b-c`;
139 use test;
141 --echo # End of 5.0 tests
143 --echo #
144 --echo # Bug #53804: serious flaws in the alter database .. upgrade data
145 --echo #             directory name command
146 --echo #
148 --error ER_BAD_DB_ERROR
149 ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
150 --error ER_WRONG_DB_NAME
151 ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
152 --error ER_WRONG_DB_NAME
153 ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
154 --error ER_WRONG_DB_NAME
155 ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
156 --error ER_WRONG_DB_NAME
157 ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
158 --error ER_WRONG_DB_NAME
159 ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
160 --error ER_WRONG_DB_NAME
161 ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
162 --error ER_WRONG_DB_NAME
163 ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
164 --error ER_WRONG_DB_NAME
165 ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
167 --error ER_WRONG_DB_NAME
168 USE `#mysql50#.`;
169 --error ER_WRONG_DB_NAME
170 USE `#mysql50#../blablabla`;
172 --echo # End of 5.1 tests