diff options
author | unknown <kroki/tomash@moonlight.intranet> | 2006-11-16 13:21:38 +0300 |
---|---|---|
committer | unknown <kroki/tomash@moonlight.intranet> | 2006-11-16 13:21:38 +0300 |
commit | e40e8052e89ada24a79c827cf38271beed756759 (patch) | |
tree | 7fc6bbe1fcb3f7be670de873e5ce9ea15027e193 /mysql-test/t/func_in.test | |
parent | 2886e07d3fa72d8aac8091c581adccb7a666a411 (diff) | |
download | mariadb-git-e40e8052e89ada24a79c827cf38271beed756759.tar.gz |
BUG#17047: CHAR() and IN() can return NULL without signaling NULL result
The problem was that some functions (namely IN() starting with 4.1, and
CHAR() starting with 5.0) were returning NULL in certain conditions,
while they didn't set their maybe_null flag. Because of that there could
be some problems with 'IS NULL' check, and statements that depend on the
function value domain, like CREATE TABLE t1 SELECT 1 IN (2, NULL);.
The fix is to set maybe_null correctly.
mysql-test/r/func_in.result:
Add result for bug#17047: CHAR() and IN() can return NULL without
signaling NULL result.
mysql-test/t/func_in.test:
Add test case for bug#17047: CHAR() and IN() can return NULL without
signaling NULL result.
sql/item_cmpfunc.cc:
Remove assignment to maybe_null, as it was already set in fix_fields()
based on all arguments, not only on the first.
Diffstat (limited to 'mysql-test/t/func_in.test')
-rw-r--r-- | mysql-test/t/func_in.test | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 2ffe5a2d5f7..ffed2aac2a0 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -109,4 +109,24 @@ 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 + +# +# BUG#17047: CHAR() and IN() can return NULL without signaling NULL +# result +# +# The problem was in the IN() function that ignored maybe_null flags +# of all arguments except the first (the one _before_ the IN +# keyword, '1' in the test case below). +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 SELECT 1 IN (2, NULL); +--echo SELECT should return NULL. +SELECT * FROM t1; + +DROP TABLE t1; + + +--echo End of 4.1 tests |