summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/atomic/rename_case.test
blob: 17151094ca26fef6d27415cc1e4abd0a5152947c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#
# This tests tries to cover renames with tables in different cases to ensure
# that lower case table names works
#

create database test2;
let $mysqld_datadir= `select @@datadir`;

--echo #
--echo # Testing rename error in different places
--echo #

create table t1 (a int);
create table T2 (b int);
create table t3 (c int);
create table T4 (d int);

insert into t1 values(1);
insert into T2 values(2);
insert into t3 values(3);
insert into T4 values(4);

create temporary table tmp1 (a int);
create temporary table tmp2 (b int);
create temporary table tmp3 (c int);
create temporary table tmp4 (d int);

insert into tmp1 values(11);
insert into tmp2 values(22);
insert into tmp3 values(33);
insert into tmp4 values(44);

--error ER_TABLE_EXISTS_ERROR
rename table t3 to T4, t1 to t5, T2 to t1, t5 to T2;
--error ER_TABLE_EXISTS_ERROR
rename table t1 to t5, t3 to T4, T2 to t1, t5 to T2;
--error ER_TABLE_EXISTS_ERROR
rename table t1 to t5, T2 to t1, t3 to T4, t5 to T2;
--error ER_TABLE_EXISTS_ERROR
rename table t1 to t5, T2 to t1, t5 to T2, t3 to T4;

--echo # Try failed rename using two databases
--error ER_NO_SUCH_TABLE
rename table test.t1 to test2.t5, test.T2 to test.t1, t5 to test.T2;

select t1.a+T2.b+t3.c+T4.d from t1,T2,t3,T4;
--error ER_NO_SUCH_TABLE
select * from t5;

--list_files $mysqld_datadir/test

--echo # Cleanup
drop table t1,T2,t3,T4;
drop database test2;