2
DROP TABLE IF EXISTS t1;
5
CREATE TEMPORARY TABLE t1 (
6
cont_nr int NOT NULL auto_increment,
7
ver_nr int NOT NULL default '0',
8
aufnr int NOT NULL default '0',
9
username varchar(50) NOT NULL default '',
10
hdl_nr int NOT NULL default '0',
11
eintrag date NOT NULL,
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 '',
17
mcbs_knr int default NULL,
18
mcbs_aufnr int NOT NULL default '0',
19
schufa_status char(1) default '?',
22
wf_igz int NOT NULL default '0',
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,
27
emp_nr int NOT NULL default '0',
28
laufzeit int default NULL,
29
hdl_name varchar(30) default NULL,
30
prov_hdl_nr int NOT NULL default '0',
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),
41
KEY idx_hdl_nr(hdl_nr),
42
KEY idx_st_klasse(st_klasse),
44
KEY eintrag_idx(eintrag),
45
KEY emp_nr_idx(emp_nr),
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),
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','','','');
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','','','');
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','','','');
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','','','');
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');
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','','','');
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','','','');
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;
85
# This failed because of syntax. Changed int(5) to int.
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'
93
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
94
INSERT INTO t1 VALUES ('40004712','000001','0020',0);
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
105
# Bug#27249 table_wild with alias: select t1.* as something
109
drop table if exists t1,t2,t3;
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);
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;
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;
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;
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;
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;
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;
186
# Valid queries without alias on wild
187
# (proof the above fail due to invalid aliasing)
190
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
193
select t1.*, t1.* from t1;
194
select t1.*, a, t1.* from t1;
196
# other fields without alias
197
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
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;
204
# other fields with alias
205
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
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;
213
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
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;
219
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
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;
226
#Bug: ap309865 These fail in drizzle: "drizzletest: Result content mismatch"
227
create table t4 select t1.* from t1;
229
create table t4 select t2.*, 1, 2 from t2;
231
create table t4 select t2.*, d as 'x', d as 'z' from t2;