Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2292 05/06/13 11:24:26 igor@stripped +3 -0
func_if.result, func_if.test:
Added a test case for bug #11142.
item_cmpfunc.cc:
Fixed bug #11142.
Implementation of Item_func_nullif::is_null was corrected.
mysql-test/r/func_if.result
1.14 05/06/13 11:23:55 igor@stripped +27 -0
Added a test case for bug #11142.
mysql-test/t/func_if.test
1.11 05/06/13 11:23:22 igor@stripped +27 -0
Added a test case for bug #11142.
sql/item_cmpfunc.cc
1.190 05/06/13 11:21:35 igor@stripped +1 -3
Fixed bug #11142.
Implementation of Item_func_nullif::is_null was corrected.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: igor
# Host: igor-inspiron.creware.com
# Root: /home/igor/dev/mysql-4.1-0
--- 1.189/sql/item_cmpfunc.cc Sun Jun 5 10:38:40 2005
+++ 1.190/sql/item_cmpfunc.cc Mon Jun 13 11:21:35 2005
@@ -1161,9 +1161,7 @@
bool
Item_func_nullif::is_null()
{
- if (!cmp.compare())
- return (null_value=1);
- return 0;
+ return (null_value= (!cmp.compare() ? 1 : args[0]->null_value));
}
/*
--- 1.13/mysql-test/r/func_if.result Wed Oct 6 05:09:39 2004
+++ 1.14/mysql-test/r/func_if.result Mon Jun 13 11:23:55 2005
@@ -86,3 +86,30 @@
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
1 0
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
+SELECT a, NULLIF(a,'') FROM t1;
+a NULLIF(a,'')
+aaa aaa
+NULL NULL
+ NULL
+bbb bbb
+SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
+a NULLIF(a,'')
+NULL NULL
+ NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
+SELECT a, NULLIF(a,'') FROM t1;
+a NULLIF(a,'')
+aaa aaa
+NULL NULL
+ NULL
+bbb bbb
+SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
+a NULLIF(a,'')
+NULL NULL
+ NULL
+DROP TABLE t1;
--- 1.10/mysql-test/t/func_if.test Wed Oct 6 09:14:30 2004
+++ 1.11/mysql-test/t/func_if.test Mon Jun 13 11:23:22 2005
@@ -60,3 +60,30 @@
# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
#
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
+#
+# Test to check evaluation of MULLIF when the first argument is NULL
+# (motivated by the Bug 11142)
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
+SELECT a, NULLIF(a,'') FROM t1;
+SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
+
+DROP TABLE t1;
+
+#
+# Test for bug #11142: evaluation of NULLIF when the first argument is NULL
+#
+
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
+
+SELECT a, NULLIF(a,'') FROM t1;
+SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
+
+DROP TABLE t1;
| Thread |
|---|
| • bk commit into 4.1 tree (igor:1.2292) BUG#11142 | igor | 13 Jun |