diff options
-rw-r--r-- | mysql-test/main/type_time.result | 6 | ||||
-rw-r--r-- | mysql-test/main/type_time.test | 5 | ||||
-rw-r--r-- | sql-common/my_time.c | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result index 14a98509b2d..8a4f977d2d9 100644 --- a/mysql-test/main/type_time.result +++ b/mysql-test/main/type_time.result @@ -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 # diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test index b2e4c4ae7ae..f57773de2ef 100644 --- a/mysql-test/main/type_time.test +++ b/mysql-test/main/type_time.test @@ -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 diff --git a/sql-common/my_time.c b/sql-common/my_time.c index c2e5aeee44b..ce6e4846fad 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -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; |