From f77509f1b38a970b5d39674d7cfd381d996b30ec Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Nov 2006 13:21:38 +0300 Subject: 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. --- mysql-test/r/func_in.result | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/r') diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 3cf2afc83d1..f74c63f7260 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -202,3 +202,11 @@ select count(*) from t1 where id not in (1,2); count(*) 1 drop table t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 SELECT 1 IN (2, NULL); +SELECT should return NULL. +SELECT * FROM t1; +1 IN (2, NULL) +NULL +DROP TABLE t1; +End of 4.1 tests -- cgit v1.2.1