Commit a53b99bf authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17417 TIME(99991231235959) returns 838:59:59 instead of 23:59:58

parent be31c18e
......@@ -2088,5 +2088,11 @@ Warning 1292 Truncated incorrect time value: '-7487797330456870912'
DROP TABLE t1;
SET optimizer_use_condition_selectivity=DEFAULT;
#
# MDEV-17417 TIME(99991231235959) returns 838:59:59 instead of 23:59:58
#
SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959);
TIME(99991231235957) TIME(99991231235958) TIME(99991231235959)
23:59:57 23:59:58 23:59:59
#
# End of 10.4 tests
#
......@@ -1361,6 +1361,11 @@ SELECT 1 FROM t1 WHERE it < -7487797330456870912;
DROP TABLE t1;
SET optimizer_use_condition_selectivity=DEFAULT;
--echo #
--echo # MDEV-17417 TIME(99991231235959) returns 838:59:59 instead of 23:59:58
--echo #
SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959);
--echo #
--echo # End of 10.4 tests
......
......@@ -1444,7 +1444,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
int number_to_time(my_bool neg, ulonglong nr, ulong sec_part,
MYSQL_TIME *ltime, int *was_cut)
{
if (nr > 9999999 && nr < 99991231235959ULL && neg == 0)
if (nr > 9999999 && nr <= 99991231235959ULL && neg == 0)
return number_to_datetime(nr, sec_part, ltime,
C_TIME_INVALID_DATES, was_cut) < 0 ? -1 : 0;
......
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