summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_if.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/func_if.test')
-rw-r--r--mysql-test/t/func_if.test12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
index 37556984f68..03590dea8d1 100644
--- a/mysql-test/t/func_if.test
+++ b/mysql-test/t/func_if.test
@@ -75,3 +75,15 @@ SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, t
SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
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;