summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_time.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r--mysql-test/t/func_time.test25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 12b7c92688f..40a6c387448 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1709,6 +1709,31 @@ SELECT
TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+
+--echo #
+--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
+--echo #
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
+SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
+SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
+DROP TABLE t1;
+
+# Maximum possible DAY_SECOND values in various formats
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
+
+# Out-of-range INTERVAL DAY_SECOND values
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
+
+
--echo #
--echo # End of 10.0 tests
--echo #