6
drop table if exists t0,t1,t2,t3,t4;
7
# Clear up from other tests (to ensure that SHOW TABLES below is right)
8
drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
11
create table t0 SELECT 1,"table 1";
12
create table t2 SELECT 2,"table 2";
13
create table t3 SELECT 3,"table 3";
14
rename table t0 to t1;
15
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
17
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
18
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
21
# The following should give errors
23
rename table t1 to t2;
25
rename table t1 to t1;
27
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
28
show tables like "t_";
30
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
32
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
38
# This should give a warning for t4
39
drop table if exists t1,t2,t3,t4;
42
# Bug #2397 RENAME TABLES is not blocked by
43
# FLUSH TABLES WITH READ LOCK
46
connect (con1,localhost,root,,);
47
connect (con2,localhost,root,,);
50
CREATE TABLE t1 (a int);
51
CREATE TABLE t3 (a int);
53
FLUSH TABLES WITH READ LOCK;
55
send RENAME TABLE t1 TO t2, t3 to t4;
63
# Wait for the the tables to be renamed
64
# i.e the query below succeds
65
let $query= select * from t2, t4;
66
source include/wait_for_query_to_suceed.inc;
77
--echo End of 4.1 tests
81
# Bug#14959: ALTER TABLE isn't able to rename a view
83
create table t1(f1 int);
84
create view v1 as select * from t1;
85
alter table v1 rename to v2;
87
alter table v1 rename to v2;
88
rename table v2 to v1;
90
rename table v2 to v1;
95
--echo End of 5.0 tests