From 0a50e43e9df2f1e005591e22388e6d20f82edf72 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 16 Jun 2016 14:57:32 +0400 Subject: [PATCH] MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true The problem was earlier fixed by the patch for MDEV-9521. Adding tests only. --- mysql-test/r/type_datetime.result | 8 ++++++++ mysql-test/t/type_datetime.test | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 82b64d30d96..e033fe48607 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -834,5 +834,13 @@ a b a b DEALLOCATE PREPARE stmt1; DROP TABLE t1,t2; # +# MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true +# +CREATE TABLE t1 (c1 DATETIME(0)); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 HAVING '2015-01-01 01:00:00.000001' > COALESCE(c1); +c1 +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index e44b190def0..3f96673c43f 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -610,6 +610,14 @@ EXECUTE stmt1; DEALLOCATE PREPARE stmt1; DROP TABLE t1,t2; +--echo # +--echo # MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true +--echo # +CREATE TABLE t1 (c1 DATETIME(0)); +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1 HAVING '2015-01-01 01:00:00.000001' > COALESCE(c1); +DROP TABLE t1; + --echo # --echo # End of 5.5 tests --echo #