~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_in.test

  • Committer: Jay Pipes
  • Date: 2009-02-28 20:43:31 UTC
  • mto: (910.2.6 mordred-noatomics)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: jpipes@serialcoder-20090228204331-6x804cdbfzyy9w8i
Merged in remove-timezone work

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
DROP TABLE t1;
138
138
 
139
139
# BUG#15872: Excessive memory consumption of range analysis of NOT IN
140
 
# I have disabled the EXPLAIN because we must use Innodb with this test.
141
 
create table t1 (a int);
 
140
create table t1 (a int) ENGINE=MYISAM;
142
141
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); 
143
 
create temporary table t2 (a int, filler char(200), key(a)) engine=myisam;
 
142
create table t2 (a int, filler char(200), key(a)) ENGINE=MYISAM;
144
143
 
145
144
insert into t2 select C.a*2,   'no'  from t1 A, t1 B, t1 C;
146
145
insert into t2 select C.a*2+1, 'yes' from t1 C;
149
148
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
150
149
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
151
150
 
152
 
153
151
explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
154
152
explain select * from t2 force index(a) where a <> 2;
155
153
 
262
260
INSERT INTO t4 VALUES (1,1),(2,2),(1000,1000),(1001,1001),(1002,1002),
263
261
       (1003,1003),(1004,1004);
264
262
 
265
 
--sorted_result
266
263
EXPLAIN SELECT STRAIGHT_JOIN * FROM t3 
267
264
  JOIN t1 ON t3.a=t1.a 
268
265
  JOIN t2 ON t3.a=t2.a
273
270
  JOIN t2 ON t3.a=t2.a
274
271
  JOIN t4 WHERE t4.a IN (t1.b, t2.b);
275
272
 
276
 
--sorted_result
277
273
EXPLAIN SELECT STRAIGHT_JOIN 
278
274
   (SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
279
275
  FROM t3, t1, t2
362
358
CREATE TABLE t1 (id int not null);
363
359
INSERT INTO t1 VALUES (1),(2);
364
360
 
365
 
--error ER_DIVISION_BY_ZERO
366
361
SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
367
362
 
368
363
DROP TABLE t1;
373
368
#
374
369
# Bug#18360: Type aggregation for IN and CASE may lead to a wrong result 
375
370
#
376
 
create TEMPORARY table t1(f1 char(1)) ENGINE=MYISAM;
 
371
create table t1(f1 char(1)) ENGINE=MYISAM;
377
372
insert into t1 values ('a'),('b'),('1');
378
373
select f1 from t1 where f1 in ('a',1);
379
374
select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
384
379
explain select f1 from t1 where f1 in ('a','b');
385
380
select f1 from t1 where f1 in (2,1);
386
381
explain select f1 from t1 where f1 in (2,1);
387
 
create TEMPORARY table t2(f2 int, index t2f2(f2)) ENGINE=MYISAM;
 
382
create table t2(f2 int, index t2f2(f2)) ENGINE=MYISAM;
388
383
insert into t2 values(0),(1),(2);
389
384
select f2 from t2 where f2 in ('a',2);
390
385
explain select f2 from t2 where f2 in ('a',2);