Fix for BUG#13419: In "ref" optimizer, take into account that item=Item_func_in(x,y) is
not equivalent to "x=y" when item->negated == TRUE.
This commit is contained in:
parent
4700631aa8
commit
40ba88ca07
@ -193,3 +193,12 @@ select * from t1 where a in (NULL, 'aa');
|
|||||||
a
|
a
|
||||||
aa
|
aa
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (id int, key(id));
|
||||||
|
insert into t1 values (1),(2),(3);
|
||||||
|
select count(*) from t1 where id not in (1);
|
||||||
|
count(*)
|
||||||
|
2
|
||||||
|
select count(*) from t1 where id not in (1,2);
|
||||||
|
count(*)
|
||||||
|
1
|
||||||
|
drop table t1;
|
||||||
|
@ -102,4 +102,11 @@ insert into t1 values ('aa'), ('bb');
|
|||||||
select * from t1 where a in (NULL, 'aa');
|
select * from t1 where a in (NULL, 'aa');
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
# BUG#13419
|
||||||
|
create table t1 (id int, key(id));
|
||||||
|
insert into t1 values (1),(2),(3);
|
||||||
|
select count(*) from t1 where id not in (1);
|
||||||
|
select count(*) from t1 where id not in (1,2);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@ -2140,7 +2140,6 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
|||||||
field Field used in comparision
|
field Field used in comparision
|
||||||
eq_func True if we used =, <=> or IS NULL
|
eq_func True if we used =, <=> or IS NULL
|
||||||
value Value used for comparison with field
|
value Value used for comparison with field
|
||||||
Is NULL for BETWEEN and IN
|
|
||||||
usable_tables Tables which can be used for key optimization
|
usable_tables Tables which can be used for key optimization
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
@ -2325,7 +2324,8 @@ add_key_fields(KEY_FIELD **key_fields,uint *and_level,
|
|||||||
add_key_field(key_fields,*and_level,cond_func,
|
add_key_field(key_fields,*and_level,cond_func,
|
||||||
((Item_field*)(cond_func->key_item()->real_item()))->field,
|
((Item_field*)(cond_func->key_item()->real_item()))->field,
|
||||||
cond_func->argument_count() == 2 &&
|
cond_func->argument_count() == 2 &&
|
||||||
cond_func->functype() == Item_func::IN_FUNC,
|
cond_func->functype() == Item_func::IN_FUNC &&
|
||||||
|
!((Item_func_in*)cond_func)->negated,
|
||||||
cond_func->arguments()+1, cond_func->argument_count()-1,
|
cond_func->arguments()+1, cond_func->argument_count()-1,
|
||||||
usable_tables);
|
usable_tables);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user