~drizzle-trunk/drizzle/development

1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
1
#
2
# Test of rename table
3
#
4
5
--disable_warnings
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;
9
--enable_warnings
10
1283.28.39 by Stewart Smith
Force Embedded InnoDB tables to have a primary key. This is because we cannot do ::position() type calls on embedded innodb tables that do not have an explicit primary key.
11
create table t0 (a int primary key, b varchar(20)) AS SELECT 1 as a,"table 1" as b;
12
create table t2 (a int primary key, b varchar(20)) as SELECT 2 as a,"table 2" as b;
13
create table t3 (a int primary key, b varchar(20)) AS SELECT 3 as a,"table 3" as b;
1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
14
rename table t0 to t1;
15
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
16
select * from 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;
19
select * from t1;
20
21
# The following should give errors
1731.3.2 by Lee Bieber
missed a few tests that needed updating with relacing error numbers with enum values
22
--error ER_TABLE_EXISTS_ERROR, ER_TABLE_EXISTS_ERROR
1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
23
rename table t1 to t2;
1731.3.2 by Lee Bieber
missed a few tests that needed updating with relacing error numbers with enum values
24
--error ER_TABLE_EXISTS_ERROR, ER_TABLE_EXISTS_ERROR
1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
25
rename table t1 to t1;
1731.3.2 by Lee Bieber
missed a few tests that needed updating with relacing error numbers with enum values
26
--error ER_TABLE_EXISTS_ERROR, ER_TABLE_EXISTS_ERROR
1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
27
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
28
show tables like "t_";
1731.3.2 by Lee Bieber
missed a few tests that needed updating with relacing error numbers with enum values
29
--error ER_TABLE_EXISTS_ERROR, ER_TABLE_EXISTS_ERROR
1283.28.2 by Stewart Smith
add basic RENAME TABLE support for Embedded InnoDB. Also add a basic test, and copy over the rename.test test and run it against embedded innodb.
30
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
31
--error ER_NO_SUCH_TABLE
32
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
33
34
select * from t1;
35
select * from t2;
36
select * from t3;
37
38
# This should give a warning for t4
1283.28.39 by Stewart Smith
Force Embedded InnoDB tables to have a primary key. This is because we cannot do ::position() type calls on embedded innodb tables that do not have an explicit primary key.
39
drop table if exists t1,t2,t3,t4;