~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/r/func_in.result

Renamed more stuff to drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
A
104
104
NULL
105
105
drop table t1;
106
 
create table t1 (id int primary key);
 
106
create table t1 (id int(10) primary key);
107
107
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
108
108
select * from t1 where id in (2,5,9);
109
109
id
112
112
9
113
113
drop table t1;
114
114
create table t1 (
115
 
a char(1),
116
 
b char(1),
117
 
c char(1)
 
115
a char(1) character set latin1 collate latin1_general_ci,
 
116
b char(1) character set latin1 collate latin1_swedish_ci,
 
117
c char(1) character set latin1 collate latin1_danish_ci
118
118
);
119
119
insert into t1 values ('A','B','C');
120
120
insert into t1 values ('a','c','c');
121
121
select * from t1 where a in (b);
122
 
a       b       c
 
122
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
123
123
select * from t1 where a in (b,c);
124
 
a       b       c
 
124
ERROR HY000: Illegal mix of collations (latin1_general_ci,IMPLICIT), (latin1_swedish_ci,IMPLICIT), (latin1_danish_ci,IMPLICIT) for operation ' IN '
125
125
select * from t1 where 'a' in (a,b,c);
126
 
a       b       c
127
 
A       B       C
128
 
a       c       c
 
126
ERROR HY000: Illegal mix of collations for operation ' IN '
129
127
select * from t1 where 'a' in (a);
130
128
a       b       c
131
129
A       B       C
134
132
a       b       c
135
133
A       B       C
136
134
a       c       c
137
 
select * from t1 where 'a' collate utf8_general_ci in (a,b,c);
 
135
select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
138
136
a       b       c
139
137
A       B       C
140
138
a       c       c
141
 
select * from t1 where 'a' collate utf8_bin in (a,b,c);
142
 
a       b       c
143
 
a       c       c
144
 
select * from t1 where 'a' in (a,b,c collate utf8_bin);
145
 
a       b       c
146
 
a       c       c
147
 
explain extended select * from t1 where 'a' in (a,b,c collate utf8_bin);
 
139
select * from t1 where 'a' collate latin1_bin in (a,b,c);
 
140
a       b       c
 
141
a       c       c
 
142
select * from t1 where 'a' in (a,b,c collate latin1_bin);
 
143
a       b       c
 
144
a       c       c
 
145
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
148
146
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
149
147
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
150
148
Warnings:
151
 
Note    1003    select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate utf8_bin)))
152
 
drop table t1;
153
 
create table t1 (a char(10) not null);
 
149
Note    1003    select "test"."t1"."a" AS "a","test"."t1"."b" AS "b","test"."t1"."c" AS "c" from "test"."t1" where ('a' in ("test"."t1"."a","test"."t1"."b",("test"."t1"."c" collate latin1_bin)))
 
150
drop table t1;
 
151
set names utf8;
 
152
create table t1 (a char(10) character set utf8 not null);
 
153
insert into t1 values ('bbbb'),(_koi8r'����'),(_latin1'����');
 
154
select a from t1 where a in ('bbbb',_koi8r'����',_latin1'����') order by a;
 
155
a
 
156
ÄÄÄÄ
 
157
bbbb
 
158
цццц
 
159
drop table t1;
 
160
create table t1 (a char(10) character set latin1 not null);
154
161
insert into t1 values ('a'),('b'),('c');
155
162
select a from t1 where a IN ('a','b','c') order by a;
156
163
a
158
165
b
159
166
c
160
167
drop table t1;
 
168
set names latin1;
161
169
select '1.0' in (1,2);
162
170
'1.0' in (1,2)
163
171
1
179
187
select 1 in ('1.1',2.0);
180
188
1 in ('1.1',2.0)
181
189
0
182
 
create table t1 (a char(2));
 
190
create table t1 (a char(2) character set binary);
183
191
insert into t1 values ('aa'), ('bb');
184
192
select * from t1 where a in (NULL, 'aa');
185
193
a
218
226
DROP TABLE t1;
219
227
create table t1 (a int);
220
228
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
221
 
create temporary table t2 (a int, filler char(200), key(a)) engine=myisam;
 
229
create table t2 (a int, filler char(200), key(a));
222
230
insert into t2 select C.a*2,   'no'  from t1 A, t1 B, t1 C;
223
231
insert into t2 select C.a*2+1, 'yes' from t1 C;
224
232
explain 
225
233
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
226
234
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
227
 
1       SIMPLE  t2      range   a       a       5       NULL    12      Using where
 
235
1       SIMPLE  t2      range   a       a       5       NULL    12      Using index condition; Using MRR
228
236
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
229
237
a       filler
230
238
1       yes
239
247
19      yes
240
248
explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
241
249
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
242
 
1       SIMPLE  t2      range   a       a       5       NULL    912     Using where
 
250
1       SIMPLE  t2      range   a       a       5       NULL    912     Using index condition; Using MRR
243
251
explain select * from t2 force index(a) where a <> 2;
244
252
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
245
 
1       SIMPLE  t2      range   a       a       5       NULL    912     Using where
 
253
1       SIMPLE  t2      range   a       a       5       NULL    912     Using index condition; Using MRR
246
254
drop table t2;
247
255
create table t2 (a datetime, filler char(200), key(a));
248
256
insert into t2 select '2006-04-25 10:00:00' + interval C.a minute,
254
262
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', 
255
263
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
256
264
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
257
 
1       SIMPLE  t2      range   a       a       9       NULL    20      Using where
 
265
1       SIMPLE  t2      range   a       a       9       NULL    18      Using index condition; Using MRR
258
266
select * from t2 where a NOT IN (
259
267
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', 
260
268
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
278
286
('barbas','1'), ('bazbazbay', '1'),('zz','1');
279
287
explain select * from t2 where a not in('foo','barbar', 'bazbazbaz');
280
288
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
281
 
1       SIMPLE  t2      range   a       a       43      NULL    5       Using where
 
289
1       SIMPLE  t2      range   a       a       13      NULL    7       Using index condition; Using MRR
282
290
drop table t2;
283
291
create table t2 (a decimal(10,5), filler char(200), key(a));
284
292
insert into t2 select 345.67890, 'no' from t1 A, t1 B;
289
297
explain
290
298
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
291
299
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
292
 
1       SIMPLE  t2      range   a       a       7       NULL    4       Using where
 
300
1       SIMPLE  t2      range   a       a       7       NULL    7       Using index condition; Using MRR
293
301
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
294
302
a       filler
295
303
0.00000 1
315
323
drop table t2;
316
324
drop table t1;
317
325
create table t1 (
318
 
some_id int,
 
326
some_id smallint(5) unsigned,
319
327
key (some_id)
320
328
);
321
329
insert into t1 values (1),(2);
349
357
JOIN t2 ON t3.a=t2.a
350
358
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
351
359
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
360
1       SIMPLE  t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
352
361
1       SIMPLE  t1      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
353
 
1       SIMPLE  t2      ALL     PRIMARY NULL    NULL    NULL    5       Using where; Using join buffer
354
 
1       SIMPLE  t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
 
362
1       SIMPLE  t2      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
355
363
1       SIMPLE  t4      ALL     PRIMARY NULL    NULL    NULL    7       Range checked for each record (index map: 0x1)
356
364
SELECT STRAIGHT_JOIN * FROM t3 
357
365
JOIN t1 ON t3.a=t1.a 
367
375
FROM t3, t1, t2
368
376
WHERE t3.a=t1.a AND t3.a=t2.a;
369
377
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
378
1       PRIMARY t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
370
379
1       PRIMARY t1      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
371
 
1       PRIMARY t2      ALL     PRIMARY NULL    NULL    NULL    5       Using where; Using join buffer
372
 
1       PRIMARY t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
 
380
1       PRIMARY t2      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
373
381
2       DEPENDENT SUBQUERY      t4      index   NULL    PRIMARY 4       NULL    7       Using where; Using index
374
382
SELECT STRAIGHT_JOIN 
375
383
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
379
387
3
380
388
3
381
389
DROP TABLE t1,t2,t3,t4;
382
 
CREATE TABLE t1(a BIGINT);
383
 
INSERT INTO t1 VALUES (0x0FFFFFFFFFFFFFFF);
 
390
CREATE TABLE t1(a BIGINT UNSIGNED);
 
391
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
384
392
SELECT * FROM t1 WHERE a=-1 OR a=-2 ;
385
393
a
386
394
SELECT * FROM t1 WHERE a IN (-1, -2);
387
395
a
388
 
CREATE TABLE t2 (a BIGINT);
 
396
CREATE TABLE t2 (a BIGINT UNSIGNED);
389
397
insert into t2 values(13491727406643098568),
390
 
(0x0fffffefffffffff),
391
 
(0x0ffffffeffffffff),
392
 
(0x0fffffffefffffff),
393
 
(0x0ffffffffeffffff),
394
 
(0x0fffffffffefffff),
395
 
(0x0ffffffffffeffff),
396
 
(0x0fffffffffffefff),
397
 
(0x0ffffffffffffeff),
398
 
(0x0fffffffffffffef),
399
 
(0x0ffffffffffffffe),
400
 
(0x0fffffffffffffff),
401
 
(0x2000000000000000),
402
 
(0x2000000000000001),
403
 
(0x2000000000000002),
404
 
(0x2000000000000300),
405
 
(0x2000000000000400),
406
 
(0x2000000000000401),
407
 
(0x2000000000004001),
408
 
(0x2000000000040001),
409
 
(0x2000000000400001),
410
 
(0x2000000004000001),
411
 
(0x2000000040000001),
412
 
(0x2000000400000001),
413
 
(0x2000004000000001),
414
 
(0x2000040000000001);
415
 
SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42);
 
398
(0x7fffffefffffffff),
 
399
(0x7ffffffeffffffff),
 
400
(0x7fffffffefffffff),
 
401
(0x7ffffffffeffffff),
 
402
(0x7fffffffffefffff),
 
403
(0x7ffffffffffeffff),
 
404
(0x7fffffffffffefff),
 
405
(0x7ffffffffffffeff),
 
406
(0x7fffffffffffffef),
 
407
(0x7ffffffffffffffe),
 
408
(0x7fffffffffffffff),
 
409
(0x8000000000000000),
 
410
(0x8000000000000001),
 
411
(0x8000000000000002),
 
412
(0x8000000000000300),
 
413
(0x8000000000000400),
 
414
(0x8000000000000401),
 
415
(0x8000000000004001),
 
416
(0x8000000000040001),
 
417
(0x8000000000400001),
 
418
(0x8000000004000001),
 
419
(0x8000000040000001),
 
420
(0x8000000400000001),
 
421
(0x8000004000000001),
 
422
(0x8000040000000001);
 
423
SELECT HEX(a) FROM t2 WHERE a IN 
 
424
(CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
 
425
42);
416
426
HEX(a)
 
427
BB3C3E98175D33C8
417
428
SELECT HEX(a) FROM t2 WHERE a IN
418
 
(0xBB3C3E98175D33C8,
419
 
0x2fffffffffffffff,
420
 
0x2000000000000000,
421
 
0x2000000000000400,
422
 
0x2000000000000401,
 
429
(CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
 
430
CAST(0x7fffffffffffffff AS UNSIGNED),
 
431
CAST(0x8000000000000000 AS UNSIGNED),
 
432
CAST(0x8000000000000400 AS UNSIGNED),
 
433
CAST(0x8000000000000401 AS UNSIGNED),
423
434
42);
424
435
HEX(a)
425
 
2000000000000000
426
 
2000000000000001
427
 
2000000000000002
428
 
2000000000000300
429
 
2000000000000400
430
 
2000000000000401
431
 
SELECT HEX(a) FROM t2 WHERE a IN 
432
 
(0x7fffffffffffffff, 
433
 
0x2000000000000001);
434
 
HEX(a)
435
 
2000000000000001
436
 
SELECT HEX(a) FROM t2 WHERE a IN 
437
 
(0x2ffffffffffffffe, 
438
 
0x2fffffffffffffff);
439
 
HEX(a)
440
 
SELECT HEX(a) FROM t2 WHERE a IN 
441
 
(0x2ffffffffffffffe, 
442
 
0x2fffffffffffffff,
 
436
BB3C3E98175D33C8
 
437
7FFFFFFFFFFFFFFF
 
438
8000000000000000
 
439
8000000000000400
 
440
8000000000000401
 
441
SELECT HEX(a) FROM t2 WHERE a IN 
 
442
(CAST(0x7fffffffffffffff AS UNSIGNED), 
 
443
CAST(0x8000000000000001 AS UNSIGNED));
 
444
HEX(a)
 
445
7FFFFFFFFFFFFFFF
 
446
8000000000000001
 
447
SELECT HEX(a) FROM t2 WHERE a IN 
 
448
(CAST(0x7ffffffffffffffe AS UNSIGNED), 
 
449
CAST(0x7fffffffffffffff AS UNSIGNED));
 
450
HEX(a)
 
451
7FFFFFFFFFFFFFFE
 
452
7FFFFFFFFFFFFFFF
 
453
SELECT HEX(a) FROM t2 WHERE a IN 
 
454
(0x7ffffffffffffffe, 
 
455
0x7fffffffffffffff,
443
456
'abc');
444
457
HEX(a)
445
 
CREATE TABLE t3 (a BIGINT);
 
458
7FFFFFFFFFFFFFFE
 
459
7FFFFFFFFFFFFFFF
 
460
CREATE TABLE t3 (a BIGINT UNSIGNED);
446
461
INSERT INTO t3 VALUES (9223372036854775551);
447
462
SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
448
463
HEX(a)
458
473
INSERT INTO t1 VALUES (1),(2);
459
474
SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
460
475
id
461
 
Warnings:
462
 
Error   1365    Division by 0
463
476
DROP TABLE t1;
464
477
End of 5.0 tests
465
 
create TEMPORARY table t1(f1 char(1)) ENGINE=MYISAM;
 
478
create table t1(f1 char(1));
466
479
insert into t1 values ('a'),('b'),('1');
467
480
select f1 from t1 where f1 in ('a',1);
468
481
f1
469
482
a
470
483
1
 
484
Warnings:
 
485
Warning 1292    Truncated incorrect DOUBLE value: 'b'
471
486
select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
472
487
f1      case f1 when 'a' then '+' when 1 then '-' end 
473
488
a       +
474
489
b       NULL
475
490
1       -
 
491
Warnings:
 
492
Warning 1292    Truncated incorrect DOUBLE value: 'b'
476
493
create index t1f1_idx on t1(f1);
477
494
select f1 from t1 where f1 in ('a',1);
478
495
f1
479
496
1
480
497
a
 
498
Warnings:
 
499
Warning 1292    Truncated incorrect DOUBLE value: 'b'
481
500
explain select f1 from t1 where f1 in ('a',1);
482
501
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
483
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
 
502
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        2       NULL    3       Using where; Using index
484
503
select f1 from t1 where f1 in ('a','b');
485
504
f1
486
505
a
487
506
b
488
507
explain select f1 from t1 where f1 in ('a','b');
489
508
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
490
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
 
509
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        2       NULL    3       Using where; Using index
491
510
select f1 from t1 where f1 in (2,1);
492
511
f1
493
512
1
 
513
Warnings:
 
514
Warning 1292    Truncated incorrect DOUBLE value: 'a'
 
515
Warning 1292    Truncated incorrect DOUBLE value: 'b'
494
516
explain select f1 from t1 where f1 in (2,1);
495
517
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
496
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
497
 
create TEMPORARY table t2(f2 int, index t2f2(f2)) ENGINE=MYISAM;
 
518
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        2       NULL    3       Using where; Using index
 
519
create table t2(f2 int, index t2f2(f2));
498
520
insert into t2 values(0),(1),(2);
499
521
select f2 from t2 where f2 in ('a',2);
500
522
f2
530
552
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
531
553
1       SIMPLE  t2      index   t2f2    t2f2    5       NULL    3       Using where; Using index
532
554
drop table t1, t2;
533
 
create table t1 (a datetime, key(a));
 
555
create table t1 (a time, key(a));
534
556
insert into t1 values (),(),(),(),(),(),(),(),(),();
535
557
select a from t1 where a not in (a,a,a) group by a;
536
558
a