From 5464e904b6db84cbbdc7aeb90fbb2115166d432f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 16 Sep 2013 14:07:01 +0400 Subject: MDEV-4861 TIME/DATETIME arithmetics does not preserve INTERVAL precision Adding tests only. The problem was earlier fixed by MDEV-4724 Some temporal functions do not preserve microseconds --- mysql-test/r/func_time.result | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'mysql-test/r/func_time.result') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 8aba949ad55..645733a3dc0 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2228,6 +2228,29 @@ SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00'); CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00') 2001-01-01 11:20:30.12 # +# MDEV-4861 TIME/DATETIME arithmetics does not preserve INTERVAL precision +# +CREATE TABLE t1 (t0 TIME); +INSERT INTO t1 VALUES ('00:00:00'); +SELECT t0 + INTERVAL 1.1 SECOND FROM t1; +t0 + INTERVAL 1.1 SECOND +00:00:01.1 +CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1; +SHOW COLUMNS FROM t2; +Field Type Null Key Default Extra +t0 + INTERVAL 1.1 SECOND time(1) YES NULL +DROP TABLE t1,t2; +CREATE TABLE t1 (t0 DATETIME); +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'); +SELECT t0 + INTERVAL 1.1 SECOND FROM t1; +t0 + INTERVAL 1.1 SECOND +2001-01-01 00:00:01.1 +CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1; +SHOW COLUMNS FROM t2; +Field Type Null Key Default Extra +t0 + INTERVAL 1.1 SECOND datetime(1) YES NULL +DROP TABLE t1, t2; +# # MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10') # CREATE TABLE t1 AS SELECT -- cgit v1.2.1