diff options
author | Gleb Shchepa <gshchepa@mysql.com> | 2008-07-14 14:06:49 +0500 |
---|---|---|
committer | Gleb Shchepa <gshchepa@mysql.com> | 2008-07-14 14:06:49 +0500 |
commit | e000e4a2a298f92c246ae10e7178ab03645a434a (patch) | |
tree | 769fb80e9c2f4df0541ee170901153747bd4c0fe /mysql-test/t/func_in.test | |
parent | 75518d0137f8acc265c327b954e8f3bb2438a0ab (diff) | |
download | mariadb-git-e000e4a2a298f92c246ae10e7178ab03645a434a.tar.gz |
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).
Diffstat (limited to 'mysql-test/t/func_in.test')
-rw-r--r-- | mysql-test/t/func_in.test | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index d8b0c89532e..d0d4dea0713 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -417,4 +417,13 @@ insert into t1 values (),(),(),(),(),(),(),(),(),(); select a from t1 where a not in (a,a,a) group by a; drop table t1; +# +# Bug #37761: IN handles NULL differently for table-subquery and value-list +# + +create table t1 (id int); +select * from t1 where NOT id in (select null union all select 1); +select * from t1 where NOT id in (null, 1); +drop table t1; + --echo End of 5.1 tests |