-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the decimal part of FROM_UNIXTIME is different from MySQL #14935
Labels
component/expression
severity/moderate
type/bug
The issue is confirmed as a bug.
type/enhancement
The issue or PR belongs to an enhancement.
Comments
This was referenced Feb 25, 2020
SunRunAway
added
type/bug
The issue is confirmed as a bug.
type/enhancement
The issue or PR belongs to an enhancement.
and removed
type/bug
The issue is confirmed as a bug.
labels
Feb 27, 2020
This was referenced Mar 10, 2020
Confirming this has been fixed in master. Here is a better testcase, since the result is timezone dependent: set time_zone='+10:00';
select from_unixtime(14516064000/10);
select from_unixtime('14516064000'/10);
select from_unixtime(cast(1451606400 as double));
set time_zone='-8:00';
select from_unixtime(14516064000/10);
select from_unixtime('14516064000'/10);
select from_unixtime(cast(1451606400 as double));
..
mysql> set time_zone='+10:00';
Query OK, 0 rows affected (0.00 sec)
mysql> select from_unixtime(14516064000/10);
+-------------------------------+
| from_unixtime(14516064000/10) |
+-------------------------------+
| 2016-01-01 10:00:00.0000 |
+-------------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime('14516064000'/10);
+---------------------------------+
| from_unixtime('14516064000'/10) |
+---------------------------------+
| 2016-01-01 10:00:00.000000 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(cast(1451606400 as double));
+-------------------------------------------+
| from_unixtime(cast(1451606400 as double)) |
+-------------------------------------------+
| 2016-01-01 10:00:00.000000 |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql> set time_zone='-8:00';
Query OK, 0 rows affected (0.00 sec)
mysql> select from_unixtime(14516064000/10);
+-------------------------------+
| from_unixtime(14516064000/10) |
+-------------------------------+
| 2015-12-31 16:00:00.0000 |
+-------------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime('14516064000'/10);
+---------------------------------+
| from_unixtime('14516064000'/10) |
+---------------------------------+
| 2015-12-31 16:00:00.000000 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> select from_unixtime(cast(1451606400 as double));
+-------------------------------------------+
| from_unixtime(cast(1451606400 as double)) |
+-------------------------------------------+
| 2015-12-31 16:00:00.000000 |
+-------------------------------------------+
1 row in set (0.01 sec)
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-944-gae779e150
Edition: Community
Git Commit Hash: ae779e1502cf99d65511387a4e1eb171bd9eb9c7
Git Branch: master
UTC Build Time: 2020-08-11 03:55:14
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) I can confirm that TiDB / MySQL 8.0 produce the same result. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component/expression
severity/moderate
type/bug
The issue is confirmed as a bug.
type/enhancement
The issue or PR belongs to an enhancement.
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
tidb-server -V
or runselect tidb_version();
on TiDB)?98f3420 @ Mon Feb 24 16:28:07 2020 +0800
The text was updated successfully, but these errors were encountered: