mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #37761: IN handles NULL differently for table-subquery
and value-list The server returns unexpected results if a right side of the NOT IN clause consists of NULL value and some constants of the same type, for example: SELECT * FROM t WHERE NOT t.id IN (NULL, 1, 2) may return 3, 4, 5 etc if a table contains these values. The Item_func_in::val_int method has been modified: unnecessary resets of an Item_func_case::has_null field value has been moved outside of an argument comparison loop. (Also unnecessary re-initialization of the null_value field has been moved). mysql-test/r/func_in.result: Added test case for bug #37761. mysql-test/t/func_in.test: Added test case for bug #37761. sql/item_cmpfunc.cc: Bug #37761: IN handles NULL differently for table-subquery and value-list The Item_func_in::val_int method has been modified: unnecessary resets of an Item_func_case::has_null field value has been moved outside of an argument comparison loop. (Also unnecessary re-initialization of the null_value field has been moved).
This commit is contained in:
@ -569,4 +569,10 @@ insert into t1 values (),(),(),(),(),(),(),(),(),();
|
||||
select a from t1 where a not in (a,a,a) group by a;
|
||||
a
|
||||
drop table t1;
|
||||
create table t1 (id int);
|
||||
select * from t1 where NOT id in (select null union all select 1);
|
||||
id
|
||||
select * from t1 where NOT id in (null, 1);
|
||||
id
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user