rename.result 1.24 KB
Newer Older
1
drop table if exists t0,t1,t2,t3,t4;
monty@mysql.com's avatar
monty@mysql.com committed
2
drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
3 4 5 6 7 8
create table t0 SELECT 1,"table 1";
create table t2 SELECT 2,"table 2";
create table t3 SELECT 3,"table 3";
rename table t0 to t1;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
select * from t1;
9 10
3	table 3
3	table 3
11 12 13
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
select * from t1;
14 15
1	table 1
1	table 1
16
rename table t1 to t2;
17
Got one of the listed errors
18
rename table t1 to t1;
19
Got one of the listed errors
20
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
21
Got one of the listed errors
22
show tables like "t_";
23 24 25 26
Tables_in_test (t_)
t1
t2
t3
27
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
28
Got one of the listed errors
29
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
30
Got one of the listed errors
31
select * from t1;
32 33
1	table 1
1	table 1
34
select * from t2;
35 36
2	table 2
2	table 2
37
select * from t3;
38 39
3	table 3
3	table 3
40
drop table if exists t1,t2,t3,t4;
41 42
Warnings:
Note	1051	Unknown table 't4'
vva@eagle.mysql.r18.ru's avatar
vva@eagle.mysql.r18.ru committed
43 44 45
CREATE TABLE t1 (a int);
CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK;
46
RENAME TABLE t1 TO t2, t3 to t4;
vva@eagle.mysql.r18.ru's avatar
vva@eagle.mysql.r18.ru committed
47 48 49 50 51 52 53 54 55 56
show tables;
Tables_in_test
t1
t3
UNLOCK TABLES;
show tables;
Tables_in_test
t2
t4
drop table t2, t4;