~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Bug with distinct and INSERT INTO
3
# Bug with group by and not used fields
4
#
5
6
--disable_warnings
7
drop table if exists t1,t2,t3;
8
--enable_warnings
9
10
CREATE TABLE t1 (id int,facility char(20));
11
CREATE TABLE t2 (facility char(20));
12
INSERT INTO t1 VALUES (NULL,NULL);
13
INSERT INTO t1 VALUES (-1,'');
14
INSERT INTO t1 VALUES (0,'');
15
INSERT INTO t1 VALUES (1,'/L');
16
INSERT INTO t1 VALUES (2,'A01');
17
INSERT INTO t1 VALUES (3,'ANC');
18
INSERT INTO t1 VALUES (4,'F01');
19
INSERT INTO t1 VALUES (5,'FBX');
20
INSERT INTO t1 VALUES (6,'MT');
21
INSERT INTO t1 VALUES (7,'P');
22
INSERT INTO t1 VALUES (8,'RV');
23
INSERT INTO t1 VALUES (9,'SRV');
24
INSERT INTO t1 VALUES (10,'VMT');
25
INSERT INTO t2 SELECT DISTINCT FACILITY FROM t1;
26
27
select id from t1 group by id;
28
select * from t1 order by id;
29
select id-5,facility from t1 order by "id-5";
30
select id,concat(facility) from t1 group by id ;
31
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
32
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
33
34
SELECT DISTINCT FACILITY FROM t1;
35
SELECT FACILITY FROM t2;
36
SELECT count(*) from t1,t2 where t1.facility=t2.facility;
37
select count(facility) from t1;
38
select count(*) from t1;
39
select count(*) from t1 where facility IS NULL;
40
select count(*) from t1 where facility = NULL;
41
select count(*) from t1 where facility IS NOT NULL;
42
select count(*) from t1 where id IS NULL;
43
select count(*) from t1 where id IS NOT NULL;
44
45
drop table t1,t2;
46
47
#
48
# Problem with distinct without results
49
#
223 by Brian Aker
Cleanup int() work.
50
CREATE TABLE t1 (UserId int DEFAULT '0' NOT NULL);
1 by brian
clean slate
51
INSERT INTO t1 VALUES (20);
52
INSERT INTO t1 VALUES (27);
53
54
SELECT UserId FROM t1 WHERE Userid=22;
55
SELECT UserId FROM t1 WHERE UserId=22 group by Userid;
56
SELECT DISTINCT UserId FROM t1 WHERE UserId=22 group by Userid;
57
SELECT DISTINCT UserId FROM t1 WHERE UserId=22;
58
drop table t1;
59
60
#
61
# Test of distinct
62
#
63
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
64
CREATE TABLE t1 (a int not null primary key,b int);
1 by brian
clean slate
65
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
66
CREATE TABLE t2 (a int not null, key (A));
1 by brian
clean slate
67
INSERT INTO t2 VALUES (1),(2);
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
68
CREATE TABLE t3 (a int, key(A), b text);
1 by brian
clean slate
69
INSERT INTO t3 VALUES (1,'1'),(2,'2');
70
SELECT DISTINCT t3.b FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
71
INSERT INTO t2 values (1),(2),(3);
72
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
73
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
74
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
75
76
# Create a lot of data into t3;
77
create temporary table t4 select * from t3;
78
insert into t3 select * from t4;
79
insert into t4 select * from t3;
80
insert into t3 select * from t4;
81
insert into t4 select * from t3;
82
insert into t3 select * from t4;
83
insert into t4 select * from t3;
84
insert into t3 select * from t4;
85
86
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
87
#flush status;
88
select distinct t1.a from t1,t3 where t1.a=t3.a;
89
#show status like 'Handler%';
90
#flush status;
91
select distinct 1 from t1,t3 where t1.a=t3.a;
92
#show status like 'Handler%';
93
94
explain SELECT distinct t1.a from t1;
95
explain SELECT distinct t1.a from t1 order by a desc;
96
explain SELECT t1.a from t1 group by a order by a desc;
97
explain SELECT distinct t1.a from t1 order by a desc limit 1;
98
explain SELECT distinct a from t3 order by a desc limit 2;
99
explain SELECT distinct a,b from t3 order by a+1;
100
explain SELECT distinct a,b from t3 order by a limit 2;
101
explain SELECT a,b from t3 group by a,b order by a+1;
102
103
drop table t1,t2,t3,t4;
104
105
CREATE TABLE t1 (name varchar(255));
106
INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae');
107
SELECT DISTINCT * FROM t1 LIMIT 2;
108
SELECT DISTINCT name FROM t1 LIMIT 2;
109
SELECT DISTINCT 1 FROM t1 LIMIT 2;
110
drop table t1;
111
112
CREATE TABLE t1 (
223 by Brian Aker
Cleanup int() work.
113
  ID int NOT NULL auto_increment,
1 by brian
clean slate
114
  NAME varchar(75) DEFAULT '' NOT NULL,
223 by Brian Aker
Cleanup int() work.
115
  LINK_ID int DEFAULT '0' NOT NULL,
1 by brian
clean slate
116
  PRIMARY KEY (ID),
117
  KEY NAME (NAME),
118
  KEY LINK_ID (LINK_ID)
119
);
120
121
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0),(2,'Jack',0),(3,'Bill',0);
122
123
CREATE TABLE t2 (
223 by Brian Aker
Cleanup int() work.
124
  ID int NOT NULL auto_increment,
1 by brian
clean slate
125
  NAME varchar(150) DEFAULT '' NOT NULL,
126
  PRIMARY KEY (ID),
127
  KEY NAME (NAME)
128
);
129
130
SELECT DISTINCT
131
    t2.id AS key_link_id,
132
    t2.name AS link
133
FROM t1
134
LEFT JOIN t2 ON t1.link_id=t2.id
135
GROUP BY t1.id
136
ORDER BY link;
137
drop table t1,t2;
138
139
#
140
# Problem with table dependencies
141
#
142
143
create table t1 (
144
    id		int not null,
145
    name	tinytext not null,
146
    unique	(id)
147
);
148
create table t2 (
149
    id		int not null,
150
    idx		int not null,
151
    unique	(id, idx)
152
);
153
create table t3 (
154
    id		int not null,
155
    idx		int not null,
156
    unique	(id, idx)
157
);
158
insert into t1 values (1,'yes'), (2,'no');
159
insert into t2 values (1,1);
160
insert into t3 values (1,1);
161
EXPLAIN
162
SELECT DISTINCT
163
    t1.id
164
from
165
    t1
166
    straight_join
167
    t2
168
    straight_join
169
    t3
170
    straight_join
171
    t1 as j_lj_t2 left join t2 as t2_lj
172
        on j_lj_t2.id=t2_lj.id
173
    straight_join
174
    t1 as j_lj_t3 left join t3 as t3_lj
175
        on j_lj_t3.id=t3_lj.id
176
WHERE
177
    ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
178
    AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
179
SELECT DISTINCT
180
    t1.id
181
from
182
    t1
183
    straight_join
184
    t2
185
    straight_join
186
    t3
187
    straight_join
188
    t1 as j_lj_t2 left join t2 as t2_lj
189
        on j_lj_t2.id=t2_lj.id
190
    straight_join
191
    t1 as j_lj_t3 left join t3 as t3_lj
192
        on j_lj_t3.id=t3_lj.id
193
WHERE
194
    ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
195
    AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
196
drop table t1,t2,t3;
197
198
#
199
# Test problem with DISTINCT and HAVING
200
#
201
create table t1 (a int not null,b char(5), c text);
202
insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
203
select distinct a from t1 group by b,a having a > 2 order by a desc;
204
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
205
drop table t1;
206
207
#
208
# Test problem with DISTINCT and ORDER BY DESC
209
#
210
211
create table t1 (a char(1), key(a)) engine=myisam;
212
insert into t1 values('1'),('1');
213
select * from t1 where a >= '1'; 
214
select distinct a from t1 order by a desc;
215
select distinct a from t1 where a >= '1' order by a desc;
216
drop table t1;
217
218
#
219
# Test when using a not previously used column in ORDER BY
220
#
221
222
CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
223
CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
224
225
INSERT INTO t1 (email, infoID, dateentered) VALUES
226
      ('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
227
      ('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
228
      ('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
229
      ('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
230
      ('test3@testdomain.com', 1, '2002-05-19 22:17:32');
231
232
INSERT INTO t2(infoID, shipcode) VALUES
233
      (1, 'Z001'),
234
      (2, 'R002');
235
236
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
237
SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
238
SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
239
drop table t1,t2;
240
241
#
242
# test with table.* in DISTINCT
243
#
244
413.2.2 by Brian Aker
Removed UNSIGNED from parser.
245
CREATE TABLE t1 (privatemessageid int NOT NULL auto_increment,  folderid int NOT NULL default '0',  userid int NOT NULL default '0',  touserid int NOT NULL default '0',  fromuserid int NOT NULL default '0',  title varchar(250) NOT NULL default '',  message mediumtext NOT NULL,  dateline int NOT NULL default '0',  showsignature int NOT NULL default '0',  iconid int NOT NULL default '0',  messageread int NOT NULL default '0',  readtime int NOT NULL default '0',  receipt int NOT NULL default '0',  deleteprompt int NOT NULL default '0',  multiplerecipients int NOT NULL default '0',  PRIMARY KEY  (privatemessageid),  KEY userid (userid)) ENGINE=MyISAM;
1 by brian
clean slate
246
INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
873.1.1 by Jay Pipes
Fixes the Field_date class to not allow any invalid input at
247
CREATE TABLE t2 (userid int NOT NULL auto_increment,  usergroupid int NOT NULL default '0',  username varchar(50) NOT NULL default '',  password varchar(50) NOT NULL default '',  email varchar(50) NOT NULL default '',  styleid int NOT NULL default '0',  parentemail varchar(50) NOT NULL default '',  coppauser int NOT NULL default '0',  homepage varchar(100) NOT NULL default '',  icq varchar(20) NOT NULL default '',  aim varchar(20) NOT NULL default '',  yahoo varchar(20) NOT NULL default '',  signature mediumtext NOT NULL,  adminemail int NOT NULL default '0',  showemail int NOT NULL default '0',  invisible int NOT NULL default '0',  usertitle varchar(250) NOT NULL default '',  customtitle int NOT NULL default '0',  joindate int NOT NULL default '0',  cookieuser int NOT NULL default '0',  daysprune int NOT NULL default '0',  lastvisit int NOT NULL default '0',  lastactivity int NOT NULL default '0',  lastpost int NOT NULL default '0',  posts int NOT NULL default '0',  timezoneoffset varchar(4) NOT NULL default '',  emailnotification int NOT NULL default '0',  buddylist mediumtext NOT NULL,  ignorelist mediumtext NOT NULL,  pmfolders mediumtext NOT NULL,  receivepm int NOT NULL default '0',  emailonpm int NOT NULL default '0',  pmpopup int NOT NULL default '0',  avatarid int NOT NULL default '0',  avatarrevision int NOT NULL default '0',  options int NOT NULL default '15',  birthday date NULL,  maxposts int NOT NULL default '-1',  startofweek int NOT NULL default '1',  ipaddress varchar(20) NOT NULL default '',  referrerid int NOT NULL default '0',  nosessionhash int NOT NULL default '0',  autorefresh int NOT NULL default '-1',  messagepopup int NOT NULL default '0',  inforum int NOT NULL default '0',  ratenum int NOT NULL default '0',  ratetotal int NOT NULL default '0',  allowrate int NOT NULL default '1',  PRIMARY KEY  (userid),  KEY usergroupid (usergroupid),  KEY username (username),  KEY inforum (inforum)) ENGINE=MyISAM;
248
INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,NULL,-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
1 by brian
clean slate
249
SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
250
DROP TABLE t1,t2;
251
252
#
253
# test with const_item in ORDER BY
254
#
255
256
CREATE TABLE t1 (a int primary key, b int, c int);
257
INSERT t1 VALUES (1,2,3);
258
CREATE TABLE t2 (a int primary key, b int, c int);
259
INSERT t2 VALUES (3,4,5);
260
SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
261
DROP TABLE t1,t2;
262
263
#
264
# Test of LEFT() with distinct
265
#
266
223 by Brian Aker
Cleanup int() work.
267
CREATE table t1 (  `id` int NOT NULL auto_increment,  `name` varchar(50) NOT NULL default '',  PRIMARY KEY  (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
1 by brian
clean slate
268
INSERT INTO t1 VALUES (1, 'aaaaa');
269
INSERT INTO t1 VALUES (3, 'aaaaa');
270
INSERT INTO t1 VALUES (2, 'eeeeeee');
271
select distinct left(name,1) as name from t1;
272
drop  table t1; 
273
274
#
275
# Test case from sel000100
276
#
277
278
CREATE TABLE t1 (
223 by Brian Aker
Cleanup int() work.
279
  ID int NOT NULL auto_increment,
1 by brian
clean slate
280
  NAME varchar(75) DEFAULT '' NOT NULL,
223 by Brian Aker
Cleanup int() work.
281
  LINK_ID int DEFAULT '0' NOT NULL,
1 by brian
clean slate
282
  PRIMARY KEY (ID),
283
  KEY NAME (NAME),
284
  KEY LINK_ID (LINK_ID)
285
);
286
287
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
288
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
289
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
290
291
CREATE TABLE t2 (
223 by Brian Aker
Cleanup int() work.
292
  ID int NOT NULL auto_increment,
1 by brian
clean slate
293
  NAME varchar(150) DEFAULT '' NOT NULL,
294
  PRIMARY KEY (ID),
295
  KEY NAME (NAME)
296
);
297
298
SELECT DISTINCT
299
    t2.id AS key_link_id,
300
    t2.name AS link
301
FROM t1
302
LEFT JOIN t2 ON t1.link_id=t2.id
303
GROUP BY t1.id
304
ORDER BY link;
305
drop table t1,t2;
306
307
#
308
# test case for #674
309
#
310
311
CREATE TABLE t1 (
312
  html varchar(5) default NULL,
223 by Brian Aker
Cleanup int() work.
313
  rin int default '0',
314
  rout int default '0'
1 by brian
clean slate
315
) ENGINE=MyISAM;
316
317
INSERT INTO t1 VALUES ('1',1,0);
318
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
319
drop table t1;
320
321
#
322
# Test cases for #12625: DISTINCT for a list with constants
323
#
324
325
CREATE TABLE t1 (a int);
326
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
327
SELECT DISTINCT a, 1 FROM t1;
328
SELECT DISTINCT 1, a FROM t1;
329
330
CREATE TABLE t2 (a int, b int); 
331
INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
332
SELECT DISTINCT a, b, 2 FROM t2;
333
SELECT DISTINCT 2, a, b FROM t2;
334
SELECT DISTINCT a, 2, b FROM t2;
335
336
DROP TABLE t1,t2;
337
#
338
# Bug#16458: Simple SELECT FOR UPDATE causes "Result Set not updatable" 
339
#   error.
340
#
341
CREATE TABLE t1(a INT PRIMARY KEY, b INT);
342
INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
343
EXPLAIN SELECT DISTINCT a FROM t1;
344
EXPLAIN SELECT DISTINCT a,b FROM t1;
345
EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
346
EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
347
  WHERE t1_1.a = t1_2.a;
348
EXPLAIN SELECT a FROM t1 GROUP BY a;
349
EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
350
EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
351
352
CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT, 
353
                PRIMARY KEY (a,b));
354
INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
355
EXPLAIN SELECT DISTINCT a FROM t2;
356
EXPLAIN SELECT DISTINCT a,a FROM t2;
357
EXPLAIN SELECT DISTINCT b,a FROM t2;
358
EXPLAIN SELECT DISTINCT a,c FROM t2;
359
EXPLAIN SELECT DISTINCT c,a,b FROM t2;
360
361
EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
362
CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
363
EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
364
365
DROP TABLE t1,t2;
366
367
# Bug 9784 DISTINCT IFNULL truncates data
368
#
369
create table t1 (id int, dsc varchar(50));
370
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
371
select distinct id, IFNULL(dsc, '-') from t1;
372
drop table t1;
373
374
#
375
# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by
376
#
377
CREATE TABLE t1 (a int primary key, b int);
378
379
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
380
381
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
382
SELECT DISTINCT a, b FROM t1 ORDER BY b;
383
DROP TABLE t1;
384
385
# End of 4.1 tests
386
387
388
#
389
# Bug #15745 ( COUNT(DISTINCT CONCAT(x,y)) returns wrong result)
390
#
391
CREATE TABLE t1 (
223 by Brian Aker
Cleanup int() work.
392
  ID int NOT NULL auto_increment,
1 by brian
clean slate
393
  x varchar(20) default NULL,
394
  y decimal(10,0) default NULL,
395
  PRIMARY KEY  (ID),
396
  KEY (y)
377.1.4 by Brian Aker
Big, fat, UTF-8 patch. This fixes some of the oddities around only one
397
) ENGINE=MyISAM;
1 by brian
clean slate
398
399
INSERT INTO t1 VALUES
400
(1,'ba','-1'),
401
(2,'ba','1150'),
402
(306,'ba','-1'),
403
(307,'ba','1150'),
404
(611,'ba','-1'),
405
(612,'ba','1150');
406
407
select count(distinct x,y) from t1;
408
select count(distinct concat(x,y)) from t1;
409
drop table t1;
410
411
#
412
# Bug #18068: SELECT DISTINCT
413
#
414
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
415
416
INSERT INTO t1 VALUES (1, 101);
417
INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
418
INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
419
INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
420
INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
421
422
EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
423
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
424
425
DROP TABLE t1;
426
427
#
428
# Bug #25551: inconsistent behaviour in grouping NULL, depending on index type
429
#
430
CREATE TABLE t1 (a INT, UNIQUE (a));
431
INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3);
432
EXPLAIN SELECT DISTINCT a FROM t1;
433
#result must have one row with NULL
434
SELECT DISTINCT a FROM t1;
435
EXPLAIN SELECT a FROM t1 GROUP BY a;
436
#result must have one row with NULL
437
SELECT a FROM t1 GROUP BY a;
438
439
DROP TABLE t1;
440
441
#
442
#Bug #27659: SELECT DISTINCT returns incorrect result set when field is
443
#repeated
444
#
445
#
446
CREATE TABLE t1 (a INT, b INT);
447
INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
448
SELECT DISTINCT a, b FROM t1;
449
SELECT DISTINCT a, a, b FROM t1;
450
DROP TABLE t1;
451
452
--echo End of 5.0 tests
453
454
#
455
# Bug #34928: Confusion by having Primary Key and Index
456
#
896.3.6 by Stewart Smith
Read Fields out of proto instead of FRM.
457
CREATE TABLE t1(a INT, b INT, c INT, d INT DEFAULT 0, e INT DEFAULT 0,
1 by brian
clean slate
458
                PRIMARY KEY(a,b,c,d,e),
459
                KEY(a,b,d,c)
460
);
461
462
INSERT INTO t1(a, b, c) VALUES (1, 1, 1),
463
                               (1, 1, 2),
464
                               (1, 1, 3),
465
                               (1, 2, 1),
466
                               (1, 2, 2),
467
                               (1, 2, 3);
468
469
EXPLAIN SELECT DISTINCT a, b, d, c FROM t1;
470
471
SELECT DISTINCT a, b, d, c FROM t1;
472
473
DROP TABLE t1;
474
475
--echo End of 5.1 tests