summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-04-28 15:56:31 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-04-28 15:56:31 +0400
commit1081e403c6ebc551b5a0242e452ccb995b262432 (patch)
treebc75a8c4a841e644f877dc38b7d07cae09290214 /mysql-test
parent968f4d4e2573fc409d5a17103269cfdcef7c2878 (diff)
downloadmariadb-git-1081e403c6ebc551b5a0242e452ccb995b262432.tar.gz
MDEV-5702 Incorrect results are returned with NULLIF()
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/ctype_numconv.inc11
-rw-r--r--mysql-test/r/ctype_binary.result17
-rw-r--r--mysql-test/r/ctype_cp1251.result17
-rw-r--r--mysql-test/r/ctype_latin1.result17
-rw-r--r--mysql-test/r/ctype_ucs.result17
-rw-r--r--mysql-test/r/ctype_utf8.result17
6 files changed, 96 insertions, 0 deletions
diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc
index 1329bebb31f..25314d53fba 100644
--- a/mysql-test/include/ctype_numconv.inc
+++ b/mysql-test/include/ctype_numconv.inc
@@ -1794,6 +1794,17 @@ SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY
DROP FUNCTION f1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-5702 Incorrect results are returned with NULLIF()
+--echo #
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 3caf41af53b..73c81c4eb06 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2848,6 +2848,23 @@ f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-5702 Incorrect results are returned with NULLIF()
+#
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+d CAST(d AS CHAR) bad good
+1999-11-11 1999-11-11 1999-11-11 1999-11-11
+2014-02-04 2014-02-04 2014-02-04 2014-02-04
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d` date DEFAULT NULL,
+ `bad` varbinary(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 4b8a26265e3..9c7164911af 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -3240,6 +3240,23 @@ f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-5702 Incorrect results are returned with NULLIF()
+#
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+d CAST(d AS CHAR) bad good
+1999-11-11 1999-11-11 1999-11-11 1999-11-11
+2014-02-04 2014-02-04 2014-02-04 2014-02-04
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d` date DEFAULT NULL,
+ `bad` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index ae6a4fd582d..11a9479afa3 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -3422,6 +3422,23 @@ f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-5702 Incorrect results are returned with NULLIF()
+#
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+d CAST(d AS CHAR) bad good
+1999-11-11 1999-11-11 1999-11-11 1999-11-11
+2014-02-04 2014-02-04 2014-02-04 2014-02-04
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d` date DEFAULT NULL,
+ `bad` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index c7e1e4e57a5..2af0b2bb509 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -4238,6 +4238,23 @@ f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-5702 Incorrect results are returned with NULLIF()
+#
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+d CAST(d AS CHAR) bad good
+1999-11-11 1999-11-11 1999-11-11 1999-11-11
+2014-02-04 2014-02-04 2014-02-04 2014-02-04
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d` date DEFAULT NULL,
+ `bad` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index fa76cc54c39..9a6dadba1f5 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -5059,6 +5059,23 @@ f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# MDEV-5702 Incorrect results are returned with NULLIF()
+#
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04');
+SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1;
+d CAST(d AS CHAR) bad good
+1999-11-11 1999-11-11 1999-11-11 1999-11-11
+2014-02-04 2014-02-04 2014-02-04 2014-02-04
+CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `d` date DEFAULT NULL,
+ `bad` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));