From 8ae2a2dbe6fc52d40ec88c325b9a44de52f83f2f Mon Sep 17 00:00:00 2001 From: Alexander Barkov <bar@mariadb.com> Date: Fri, 3 Aug 2018 09:03:11 +0400 Subject: [PATCH] MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME) This problem was earlier fixed by the patch for MDEV-15340. Adding tests only. --- mysql-test/main/func_time.result | 9 +++++++++ mysql-test/main/func_time.test | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index cda36932be0..8a7a990bb85 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -3559,3 +3559,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where subtime(`test`.`t1`.`a`,TIME'00:00:01') = TIME'00:00:09' and addtime(`test`.`t1`.`a`,TIME'00:00:01') <= TIME'00:00:09' DROP TABLE t1; +# +# MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME) +# +SELECT +LAST_DAY(TIME'00:00:00') AS c1, +CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2, +CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3; +c1 c2 c3 +2018-08-31 00:00:00 00:00:00 diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index cbce3dc26bc..53cfd29dc9c 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -2149,3 +2149,13 @@ SELECT * FROM t1 WHERE ADDTIME(a,TIME'00:00:01')<=TIME'00:00:09'; SELECT * FROM t1 WHERE SUBTIME(a,TIME'00:00:01')=TIME'00:00:09' AND ADDTIME(a,TIME'00:00:01')<=TIME'00:00:09'; EXPLAIN EXTENDED SELECT * FROM t1 WHERE SUBTIME(a,TIME'00:00:01')=TIME'00:00:09' AND ADDTIME(a,TIME'00:00:01')<=TIME'00:00:09'; DROP TABLE t1; + + +--echo # +--echo # MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME) +--echo # + +SELECT + LAST_DAY(TIME'00:00:00') AS c1, + CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2, + CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3; -- 2.30.9