From e90f8b7a683a47b47417d847b69c52e2138e2259 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 20 Apr 2016 11:11:13 +0400 Subject: [PATCH] MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL The patch for MDEV-9521 earlier fixed the problem reported in MDEV-9413. Only adding tests. --- mysql-test/r/type_timestamp.result | 9 +++++++++ mysql-test/t/type_timestamp.test | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 52c7f05839e..1f17247b02a 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -644,4 +644,13 @@ SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; MAX(dt) = '2011-01-06 12:34:30' 1 DROP TABLE t1; +# +# MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL +# +CREATE TABLE t1(c1 TIMESTAMP(6) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL); +SELECT c1, '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) FROM t1; +c1 '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) +NULL NULL +DROP TABLE t1; End of 5.5 tests diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 575c30431b6..0cc9c37fee9 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -446,4 +446,12 @@ SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1; SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL +--echo # +CREATE TABLE t1(c1 TIMESTAMP(6) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL); +SELECT c1, '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) FROM t1; +DROP TABLE t1; + --echo End of 5.5 tests