You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The valid range of timestamp is 32 bit is '1970-01-01 00:00:01.000000' UTC to '2038-01-19 03:14:07.999999' UTC, which corresponds to Unix timestamp range 1 to 2147483647.
But, TiDB returns an out of range value through rounding.
64-bit unix timestamp is supported in MySQL 8.0.28 but prior to MySQL 8.0.28, it is not supported.
1. Minimal reproduce step
SET time_zone='+00:00';
SELECT
FROM_UNIXTIME(2147483647) AS c1,
FROM_UNIXTIME(2147483648) AS c2,
FROM_UNIXTIME(2147483647.9999999) AS c3;
SET time_zone=default;
SELECT
FROM_UNIXTIME(2147483647) AS c1,
FROM_UNIXTIME(2147483648) AS c2,
FROM_UNIXTIME(2147483647.9999999) AS c3;
2. What did you expect to see?
In MySQL8.0.25
mysql> SET time_zone='+00:00';
Query OK, 0 rows affected (0.01 sec)
mysql> SELECT
-> FROM_UNIXTIME(2147483647) AS c1,
-> FROM_UNIXTIME(2147483648) AS c2,
-> FROM_UNIXTIME(2147483647.9999999) AS c3;
+---------------------+------+------+
| c1 | c2 | c3 |
+---------------------+------+------+
| 2038-01-19 03:14:07 | NULL | NULL |
+---------------------+------+------+
1 row in set (0.00 sec)
mysql> SET time_zone=default;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT
-> FROM_UNIXTIME(2147483647) AS c1,
-> FROM_UNIXTIME(2147483648) AS c2,
-> FROM_UNIXTIME(2147483647.9999999) AS c3;
+---------------------+------+------+
| c1 | c2 | c3 |
+---------------------+------+------+
| 2038-01-18 19:14:07 | NULL | NULL |
+---------------------+------+------+
espresso98
changed the title
FROM_UNIXTIME returns an out of range argument through roundingFROM_UNIXTIME returns an out of range value through rounding
Jan 18, 2022
morgo
changed the title
FROM_UNIXTIME returns an out of range value through rounding
FROM_UNIXTIME(), UNIX_TIMESTAMP(), CONVERT_TZ do not handle 64-bit values correctly
Feb 2, 2022
Bug Report
The valid range of timestamp is 32 bit is '1970-01-01 00:00:01.000000' UTC to '2038-01-19 03:14:07.999999' UTC, which corresponds to Unix timestamp range 1 to 2147483647.
But, TiDB returns an out of range value through rounding.
64-bit unix timestamp is supported in MySQL 8.0.28 but prior to MySQL 8.0.28, it is not supported.
1. Minimal reproduce step
2. What did you expect to see?
In MySQL8.0.25
In MySQL 8.0.28
3. What did you see instead
4. What is your TiDB version?
The text was updated successfully, but these errors were encountered: