mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / lowercase_view.test
blob52be911cde0f46e1dc42030e5298888be5c57c90
1 --disable_warnings
2 drop table if exists t1Aa,t2Aa,v1Aa,v2Aa;
3 drop view if exists t1Aa,t2Aa,v1Aa,v2Aa;
4 drop database if exists MySQLTest;
5 --enable_warnings
8 # different cases in VIEW
10 create database MySQLTest;
11 use MySQLTest;
12 create table TaB (Field int);
13 create view ViE as select * from TAb;
14 show create table VIe;
15 drop database MySQLTest;
16 use test;
19 # test of updating and fetching from the same table check
21 create table t1Aa (col1 int);
22 create table t2aA (col1 int);
23 create view v1Aa as select * from t1aA;
24 create view v2aA as select * from v1aA;
25 create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
26 -- error 1443
27 update v2aA set col1 = (select max(col1) from v1Aa);
28 -- error 1443
29 update v2Aa set col1 = (select max(col1) from t1Aa);
30 -- error 1093
31 update v2aA set col1 = (select max(col1) from v2Aa);
32 -- error 1443
33 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1;
34 -- error 1443
35 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1;
36 -- error 1093
37 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
38 -- error 1443
39 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1;
40 -- error 1443
41 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1;
42 -- error 1443
43 update t2Aa,v1aA set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1;
44 -- error 1443
45 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1;
46 -- error 1093
47 update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
48 -- error 1443
49 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1;
50 -- error 1093
51 update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1;
52 -- error 1093
53 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1;
54 -- error 1093
55 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1;
56 -- error 1093
57 update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
58 -- error 1443
59 update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1;
60 -- error 1443
61 update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1;
62 -- error 1443
63 update t2Aa,v2aA set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1;
64 -- error 1443
65 update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v2aA) where t1Aa.col1 = t2aA.col1;
66 -- error 1443
67 update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from v2Aa) where v1Aa.col1 = t2aA.col1;
68 -- error 1443
69 update v3aA set v3Aa.col1 = (select max(col1) from v1aA);
70 -- error 1443
71 update v3aA set v3Aa.col1 = (select max(col1) from t1aA);
72 -- error 1443
73 update v3aA set v3Aa.col1 = (select max(col1) from v2aA);
74 -- error 1093
75 update v3aA set v3Aa.col1 = (select max(col1) from v3aA);
76 -- error 1443
77 delete from v2Aa where col1 = (select max(col1) from v1Aa);
78 -- error 1443
79 delete from v2aA where col1 = (select max(col1) from t1Aa);
80 -- error 1093
81 delete from v2Aa where col1 = (select max(col1) from v2aA);
82 -- error 1443
83 delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1;
84 -- error 1443
85 delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1;
86 -- error 1093
87 delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1;
88 -- error 1443
89 delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1;
90 -- error 1093
91 delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1;
92 -- error 1443
93 delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1;
94 -- error 1093
95 delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1;
96 -- error 1443
97 delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1;
98 -- error 1443
99 delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1;
100 -- error 1443
101 insert into v2Aa values ((select max(col1) from v1aA));
102 -- error 1443
103 insert into t1aA values ((select max(col1) from v1Aa));
104 -- error 1443
105 insert into v2aA values ((select max(col1) from v1aA));
106 -- error 1443
107 insert into v2Aa values ((select max(col1) from t1Aa));
108 -- error 1093
109 insert into t1aA values ((select max(col1) from t1Aa));
110 -- error 1443
111 insert into v2aA values ((select max(col1) from t1aA));
112 -- error 1093
113 insert into v2Aa values ((select max(col1) from v2aA));
114 -- error 1443
115 insert into t1Aa values ((select max(col1) from v2Aa));
116 -- error 1093
117 insert into v2aA values ((select max(col1) from v2Aa));
118 -- error 1443
119 insert into v3Aa (col1) values ((select max(col1) from v1Aa));
120 -- error 1443
121 insert into v3aA (col1) values ((select max(col1) from t1aA));
122 -- error 1443
123 insert into v3Aa (col1) values ((select max(col1) from v2aA));
124 drop view v3aA,v2Aa,v1aA;
125 drop table t1Aa,t2Aa;
128 # aliases in VIEWs
130 create table t1Aa (col1 int);
131 create view v1Aa as select col1 from t1Aa as AaA;
132 show create view v1AA;
133 drop view v1AA;
134 select Aaa.col1 from t1Aa as AaA;
135 create view v1Aa as select Aaa.col1 from t1Aa as AaA;
136 drop view v1AA;
137 create view v1Aa as select AaA.col1 from t1Aa as AaA;
138 show create view v1AA;
139 drop view v1AA;
140 drop table t1Aa;
144 # Bug #31562: HAVING and lower case
147 CREATE TABLE  t1 (a int, b int);
149 select X.a from t1 AS X group by X.b having (X.a = 1);
150 select X.a from t1 AS X group by X.b having (x.a = 1);
151 select X.a from t1 AS X group by X.b having (x.b = 1);
153 CREATE OR REPLACE VIEW v1 AS
154 select X.a from t1 AS X group by X.b having (X.a = 1);
156 SHOW CREATE VIEW v1;
158 SELECT * FROM v1;
160 DROP VIEW v1;
161 DROP TABLE t1;
164 --echo End of 5.0 tests.
167 --echo #
168 --echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
169 --echo #  returns nothing
170 --echo #
172 CREATE TABLE `ttt` (
173   `f1` char(3) NOT NULL,
174   PRIMARY KEY (`f1`)
175 ) ENGINE=myisam DEFAULT CHARSET=latin1;
177 SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
178 'TTT';
179 SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
181 DROP TABLE `ttt`;
184 --echo End of 5.0 tests.