summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-11-16 13:25:55 +0300
committerunknown <kroki/tomash@moonlight.intranet>2006-11-16 13:25:55 +0300
commitec845335ac32a81d8d88245a1df4c74965b76f42 (patch)
treec90d750e2c924c20e2f6b64eb1a1fc607e924038
parent413d2e28b69162d4918c1bd87017c95d07c399ec (diff)
parente40e8052e89ada24a79c827cf38271beed756759 (diff)
downloadmariadb-git-ec845335ac32a81d8d88245a1df4c74965b76f42.tar.gz
Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-4.1-bug17047
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug17047 sql/item_cmpfunc.cc: Auto merged mysql-test/r/func_in.result: Manual merge. Add "End of 5.0 tests". mysql-test/t/func_in.test: Manual merge. Add "End of 5.0 tests".
-rw-r--r--mysql-test/r/func_in.result9
-rw-r--r--mysql-test/t/func_in.test26
-rw-r--r--sql/item_cmpfunc.cc1
3 files changed, 34 insertions, 2 deletions
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index e38e2624e19..a172d04d880 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -202,6 +202,14 @@ 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
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45);
@@ -343,3 +351,4 @@ some_id
1
2
drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 8ddf1fbe314..d48606ac6e6 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -109,7 +109,28 @@ 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
+
#
# Bug #11885: WHERE condition with NOT IN (one element)
@@ -232,3 +253,6 @@ select some_id from t1 where some_id not in(2,-1);
select some_id from t1 where some_id not in(-4,-1,-4);
select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
drop table t1;
+
+
+--echo End of 5.0 tests
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9a400d60ae6..70a8622af85 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2465,7 +2465,6 @@ void Item_func_in::fix_length_and_dec()
if (cmp_type == STRING_RESULT)
in_item->cmp_charset= cmp_collation.collation;
}
- maybe_null= args[0]->maybe_null;
max_length= 1;
}