~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/lowercase_table.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
Import upstream version 5.1.45

Show diffs side-by-side

added added

removed removed

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