Commit 5464e904 authored by Alexander Barkov's avatar Alexander Barkov

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 
parent 22c4a249
......@@ -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
......
......@@ -1346,6 +1346,24 @@ SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123456 SECOND);
SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 'xxx' SECOND);
SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00');
--echo #
--echo # MDEV-4861 TIME/DATETIME arithmetics does not preserve INTERVAL precision
--echo #
CREATE TABLE t1 (t0 TIME);
INSERT INTO t1 VALUES ('00:00:00');
SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
SHOW COLUMNS FROM t2;
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;
CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
SHOW COLUMNS FROM t2;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10')
--echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment