Commit 48c11d40 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime

parent 4a35e76f
......@@ -2878,5 +2878,29 @@ NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
#
# MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
#
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
MAX(NULLIF(i,1))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR))
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
#
# End of 10.0 tests
#
......@@ -1758,6 +1758,22 @@ 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 # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
--echo #
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
DROP TABLE t1;
CREATE TABLE t1 (i INT, d DATE);
INSERT INTO t1 VALUES (1, '1970-01-01');
SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
DROP TABLE t1;
SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
--echo #
--echo # End of 10.0 tests
......
......@@ -960,6 +960,8 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
ltime->day= 0;
return 0;
}
else if (ltime->neg)
goto invalid_date;
if (int_type != INTERVAL_DAY)
ltime->time_type= MYSQL_TIMESTAMP_DATETIME; // Return full date
......
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