~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
--disable_warnings
2
DROP TABLE IF EXISTS t1;
3
--enable_warnings
4
1063.9.3 by Brian Aker
Partial fix for tests for tmp
5
CREATE TEMPORARY TABLE t1 (
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
6
  cont_nr int NOT NULL auto_increment,
7
  ver_nr int NOT NULL default '0',
8
  aufnr int NOT NULL default '0',
1 by brian
clean slate
9
  username varchar(50) NOT NULL default '',
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
10
  hdl_nr int NOT NULL default '0',
873.1.1 by Jay Pipes
Fixes the Field_date class to not allow any invalid input at
11
  eintrag date NOT NULL, 
1 by brian
clean slate
12
  st_klasse varchar(40) NOT NULL default '',
13
  st_wert varchar(40) NOT NULL default '',
14
  st_zusatz varchar(40) NOT NULL default '',
15
  st_bemerkung varchar(255) NOT NULL default '',
16
  kunden_art varchar(40) NOT NULL default '',
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
17
  mcbs_knr int default NULL,
18
  mcbs_aufnr int NOT NULL default '0',
1 by brian
clean slate
19
  schufa_status char(1) default '?',
20
  bemerkung text,
21
  wirknetz text,
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
22
  wf_igz int NOT NULL default '0',
1 by brian
clean slate
23
  tarifcode varchar(80) default NULL,
24
  recycle char(1) default NULL,
25
  sim varchar(30) default NULL,
26
  mcbs_tpl varchar(30) default NULL,
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
27
  emp_nr int NOT NULL default '0',
28
  laufzeit int default NULL,
1 by brian
clean slate
29
  hdl_name varchar(30) default NULL,
383.2.3 by Jay Pipes
Removed ZEROFILL args in CREATE statements. Still needs UTF8 fixes
30
  prov_hdl_nr int NOT NULL default '0',
1 by brian
clean slate
31
  auto_wirknetz varchar(50) default NULL,
32
  auto_billing varchar(50) default NULL,
33
  touch timestamp NOT NULL,
34
  kategorie varchar(50) default NULL,
35
  kundentyp varchar(20) NOT NULL default '',
36
  sammel_rech_msisdn varchar(30) NOT NULL default '',
37
  p_nr varchar(9) NOT NULL default '',
38
  suffix char(3) NOT NULL default '',
39
  PRIMARY KEY (cont_nr),
40
  KEY idx_aufnr(aufnr),
41
  KEY idx_hdl_nr(hdl_nr),
42
  KEY idx_st_klasse(st_klasse),
43
  KEY ver_nr(ver_nr),
44
  KEY eintrag_idx(eintrag),
45
  KEY emp_nr_idx(emp_nr),
46
  KEY wf_igz(wf_igz),
47
  KEY touch(touch),
48
  KEY hdl_tag(eintrag,hdl_nr),
49
  KEY prov_hdl_nr(prov_hdl_nr),
50
  KEY mcbs_aufnr(mcbs_aufnr),
51
  KEY kundentyp(kundentyp),
52
  KEY p_nr(p_nr,suffix)
53
) ENGINE=MyISAM;
54
642.1.67 by Lee
enable alias and analyze tests
55
# BUG: ap309774   This died because we used a German umlaut  
56
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto','2001-02-02 10:59:16','Mobilfunk','PP','','','');
57
58
# This died because we used a German umlaut
59
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
60
61
# This died because we used a German umlaut
62
INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
63
64
# This died because we used a German umlaut
65
INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
66
67
# This died because we used a German umlaut
68
INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007');
69
70
# This died because we used a German umlaut
71
INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. mchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
72
73
# This died because we used a German umlaut
74
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
1 by brian
clean slate
75
76
# This died because we used the field Kundentyp twice
77
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
78
79
drop table t1;
80
81
#
82
# test case for #570
83
#
84
642.1.67 by Lee
enable alias and analyze tests
85
# This failed because of syntax. Changed int(5) to int.
1 by brian
clean slate
86
CREATE TABLE t1 (
642.1.67 by Lee
enable alias and analyze tests
87
  aufnr varchar(12) NOT NULL default '',
88
  plnfl	varchar(6) NOT NULL default '',
89
  vornr varchar(4) NOT NULL default '',
90
  xstatus_vor int NOT NULL default '0'
1 by brian
clean slate
91
);
92
93
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
94
INSERT INTO t1 VALUES ('40004712','000001','0020',0);
95
96
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
97
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
98
ASC LIMIT 1;
99
100
drop table t1;
101
102
# End of 4.1 tests
103
104
#
105
# Bug#27249 table_wild with alias: select t1.* as something
106
#
107
108
--disable_warnings
109
drop table if exists t1,t2,t3;
110
--enable_warnings
111
112
create table t1 (a int, b int, c int);
113
create table t2 (d int);
114
create table t3 (a1 int, b1 int, c1 int);
115
insert into t1 values(1,2,3);
116
insert into t1 values(11,22,33);
117
insert into t2 values(99);
118
119
# Invalid queries with alias on wild
120
--error ER_PARSE_ERROR
121
select t1.* as 'with_alias' from t1;
122
--error ER_PARSE_ERROR
123
select t2.* as 'with_alias' from t2;
124
--error ER_PARSE_ERROR
125
select t1.*, t1.* as 'with_alias' from t1;
126
--error ER_PARSE_ERROR
127
select t1.* as 'with_alias', t1.* from t1;
128
--error ER_PARSE_ERROR
129
select t1.* as 'with_alias', t1.* as 'alias2' from t1;
130
--error ER_PARSE_ERROR
131
select t1.* as 'with_alias', a, t1.* as 'alias2' from t1;
132
133
# other fields without alias
134
--error ER_PARSE_ERROR
135
select a, t1.* as 'with_alias' from t1;
136
--error ER_PARSE_ERROR
137
select t1.* as 'with_alias', a from t1;
138
--error ER_PARSE_ERROR
139
select a, t1.* as 'with_alias', b from t1;
140
--error ER_PARSE_ERROR
141
select (select d from t2 where d > a), t1.* as 'with_alias' from t1;
142
--error ER_PARSE_ERROR
143
select t1.* as 'with_alias', (select a from t2 where d > a) from t1;
144
145
# other fields with alias
146
--error ER_PARSE_ERROR
147
select a as 'x', t1.* as 'with_alias' from t1;
148
--error ER_PARSE_ERROR
149
select t1.* as 'with_alias', a as 'x' from t1;
150
--error ER_PARSE_ERROR
151
select a as 'x', t1.* as 'with_alias', b as 'x' from t1;
152
--error ER_PARSE_ERROR
153
select (select d from t2 where d > a) as 'x', t1.* as 'with_alias' from t1;
154
--error ER_PARSE_ERROR
155
select t1.* as 'with_alias', (select a from t2 where d > a) as 'x' from t1;
156
157
# some more subquery
158
--error ER_PARSE_ERROR
159
select (select t2.* as 'x' from t2) from t1;
160
--error ER_PARSE_ERROR
161
select a, (select t2.* as 'x' from t2) from t1;
162
--error ER_PARSE_ERROR
163
select t1.*, (select t2.* as 'x' from t2) from t1;
164
165
# insert
166
--error ER_PARSE_ERROR
167
insert into t3 select t1.* as 'with_alias' from t1;
168
--error ER_PARSE_ERROR
169
insert into t3 select t2.* as 'with_alias', 1, 2 from t2;
170
--error ER_PARSE_ERROR
171
insert into t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
172
--error ER_PARSE_ERROR
173
insert into t3 select t2.*, t2.* as 'with_alias', 3 from t2;
174
175
# create
176
--error ER_PARSE_ERROR
177
create table t3 select t1.* as 'with_alias' from t1;
178
--error ER_PARSE_ERROR
179
create table t3 select t2.* as 'with_alias', 1, 2 from t2;
180
--error ER_PARSE_ERROR
181
create table t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
182
--error ER_PARSE_ERROR
183
create table t3 select t2.*, t2.* as 'with_alias', 3 from t2;
184
185
#
186
# Valid queries without alias on wild
187
# (proof the above fail due to invalid aliasing)
188
#
189
642.1.67 by Lee
enable alias and analyze tests
190
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
191
select t1.* from t1;
192
select t2.* from t2;
193
select t1.*, t1.* from t1;
194
select t1.*, a, t1.* from t1;
1 by brian
clean slate
195
196
# other fields without alias
642.1.67 by Lee
enable alias and analyze tests
197
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
198
select a, t1.* from t1;
199
select t1.*, a from t1;
200
select a, t1.*, b from t1;
201
select (select d from t2 where d > a), t1.* from t1;
202
select t1.*, (select a from t2 where d > a) from t1;
1 by brian
clean slate
203
204
# other fields with alias
642.1.67 by Lee
enable alias and analyze tests
205
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
206
select a as 'x', t1.* from t1;
207
select t1.*, a as 'x' from t1;
208
select a as 'x', t1.*, b as 'x' from t1;
209
select (select d from t2 where d > a) as 'x', t1.* from t1;
210
select t1.*, (select a from t2 where d > a) as 'x' from t1;
1 by brian
clean slate
211
212
# some more subquery
642.1.67 by Lee
enable alias and analyze tests
213
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
214
select (select t2.* from t2) from t1;
215
select a, (select t2.* from t2) from t1;
216
select t1.*, (select t2.* from t2) from t1;
1 by brian
clean slate
217
218
# insert
642.1.67 by Lee
enable alias and analyze tests
219
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
220
insert into t3 select t1.* from t1;
221
insert into t3 select t2.*, 1, 2 from t2;
222
insert into t3 select t2.*, d as 'x', d as 'z' from t2;
223
insert into t3 select t2.*, t2.*, 3 from t2;
1 by brian
clean slate
224
225
# create
642.1.67 by Lee
enable alias and analyze tests
226
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
1211.2.1 by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test.
227
create table t4 select t1.* from t1;
228
drop table t4;
229
create table t4 select t2.*, 1, 2 from t2;
230
drop table t4;
231
create table t4 select t2.*, d as 'x', d as 'z' from t2;
232
drop table t4;
1 by brian
clean slate
233
234
# end
235
drop table t1,t2,t3;
236
237
# End of 5.2 tests