|
|
|
@ -529,6 +529,34 @@ b a |
|
|
|
y |
|
|
|
z |
|
|
|
DROP TABLE t1; |
|
|
|
# |
|
|
|
# BUG#40974: Incorrect query results when using clause evaluated using range check |
|
|
|
# |
|
|
|
create table t0 (a int); |
|
|
|
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); |
|
|
|
create table t1 (a int); |
|
|
|
insert into t1 values (1),(2); |
|
|
|
create table t2(a int, b int); |
|
|
|
insert into t2 values (1,1), (2, 1000); |
|
|
|
create table t3 (a int, b int, filler char(100), key(a), key(b)); |
|
|
|
insert into t3 select 1000, 1000,'filler' from t0 A, t0 B, t0 C; |
|
|
|
insert into t3 values (1,1,'data'); |
|
|
|
insert into t3 values (1,1,'data'); |
|
|
|
The plan should be ALL/ALL/ALL(Range checked for each record (index map: 0x3) |
|
|
|
explain select * from t1 |
|
|
|
where exists (select 1 from t2, t3 |
|
|
|
where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); |
|
|
|
id select_type table type possible_keys key key_len ref rows Extra |
|
|
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where |
|
|
|
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where |
|
|
|
2 DEPENDENT SUBQUERY t3 ALL a,b NULL NULL NULL 1002 Range checked for each record (index map: 0x3) |
|
|
|
select * from t1 |
|
|
|
where exists (select 1 from t2, t3 |
|
|
|
where t2.a=t1.a and (t3.a=t2.b or t3.b=t2.b or t3.b=t2.b+1)); |
|
|
|
a |
|
|
|
1 |
|
|
|
2 |
|
|
|
drop table t0, t1, t2, t3; |
|
|
|
End of 5.0 tests |
|
|
|
#---------------- ROR-index_merge tests ----------------------- |
|
|
|
SET SESSION STORAGE_ENGINE = MyISAM; |
|
|
|
|