~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Test of --lower-case-table-names
3
#
4
5
--disable_warnings
6
drop table if exists 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;
9
drop database if exists mysqltest;
10
--enable_warnings
11
12
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
13
create table t4 (id int primary key, Word varchar(40) not null);
14
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
15
INSERT INTO T4 VALUES(1,'match');
16
SELECT * FROM t1;
17
SELECT T1.id from T1 LIMIT 1;
18
SELECT T2.id from t1 as T2 LIMIT 1;
19
SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
20
# This gave an error in 4.0, but it's fixed in 4.1
21
SELECT T2.id from t1 as t2 LIMIT 1;
22
RENAME TABLE T1 TO T2;
23
ALTER TABLE T2 ADD new_col int not null;
24
ALTER TABLE T2 RENAME T3;
25
show tables like 't_';
26
drop table t3,t4;
27
#
28
# Test alias
29
#
30
create table t1 (a int);
31
select count(*) from T1;
32
select count(*) from t1;
33
select count(T1.a) from t1;
34
select count(bags.a) from t1 as Bags;
35
drop table t1;
36
37
#
38
# Test all caps database name
39
#
40
create database mysqltest;
41
use MYSQLTEST;
42
create table t1 (a int);
43
select T1.a from MYSQLTEST.T1;
44
select t1.a from MYSQLTEST.T1;
45
select mysqltest.t1.* from MYSQLTEST.t1;
46
select MYSQLTEST.t1.* from MYSQLTEST.t1;
47
select MYSQLTEST.T1.* from MYSQLTEST.T1;
48
select MYSQLTEST.T1.* from T1;
49
alter table t1 rename to T1;
50
select MYSQLTEST.t1.* from MYSQLTEST.t1;
51
drop database mysqltest;
52
use test;
53
54
#
55
# multiupdate/delete & --lower-case-table-names
56
#
57
create table t1 (a int);
58
create table t2 (a int);
59
delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
60
delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
61
update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
62
update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
63
drop table t1,t2;
64
65
#
66
# aliases case insensitive
67
#
68
create table t1 (a int);
69
create table t2 (a int);
70
-- error 1066
71
select * from t1 c, t2 C;
72
-- error 1066
73
select C.a, c.a from t1 c, t2 C;
74
drop table t1, t2;
75
76
#
77
# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when
78
# lower_case_table_names is set
79
80
create table t1 (a int);
81
create table t2 like T1;
82
drop table t1, t2;
83
84
show tables;
85
86
# End of 4.1 tests
87
88
89
#
90
# Bug#20404: SHOW CREATE TABLE fails with Turkish I
91
#
92
set names utf8;
93
--disable_warnings
94
drop table if exists İ,İİ;
95
--enable_warnings
96
create table İ (s1 int);
97
show create table İ;
98
show tables;
99
drop table İ;
100
create table İİ (s1 int);
101
show create table İİ;
102
show tables;
103
drop table İİ;
104
set names latin1;
105
106
--echo End of 5.0 tests