-
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
CONVERT_TZ () TIDB result differ with mysql in few cases: #30081
Comments
/assign |
cannot reproduce at |
Nothing specific : |
@sylzd I can reproduce with default SQL mode, any timezone (or at least my time + UTC) using the hash you provided: tidb> SELECT
-> CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1,
-> CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time2;
+-------+---------------------+
| time1 | time2 |
+-------+---------------------+
| NULL | 2007-03-11 01:00:00 |
+-------+---------------------+
1 row in set (0.00 sec)
tidb> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.4.0-alpha-67-g17edc5758
Edition: Community
Git Commit Hash: 17edc5758fbf865cada7e156318c41d3ee8a7501
Git Branch: HEAD
UTC Build Time: 2021-11-24 16:28:23
GoVersion: go1.16.9
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
tidb> SET time_zone='UTC';
Query OK, 0 rows affected (0.00 sec)
tidb> SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1, CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time2;
+-------+---------------------+
| time1 | time2 |
+-------+---------------------+
| NULL | 2007-03-11 01:00:00 |
+-------+---------------------+
1 row in set (0.00 sec)
tidb> SET sql_mode = DEFAULT;
Query OK, 0 rows affected (0.00 sec)
tidb> SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1, CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time2;
+-------+---------------------+
| time1 | time2 |
+-------+---------------------+
| NULL | 2007-03-11 01:00:00 |
+-------+---------------------+
1 row in set (0.00 sec) It is only time1 which is invalid. This might be related to Daylight savings - when comparing to MySQL make sure to load the timezone database (it is loaded in TiDB by default, but not MySQL). |
|
Thanks! I will comment on this issue. |
that is weird. my result is like that. It seems related to the DST server configure. I'll keep concerned about #28739.
|
Tested in 2970dd4 , the bug is still here. I think it also affects release-6.2. And I got some report it happened in release-4.0. TiDB:
MySQL:
And I also test it in Postgresql, it seems to have the same behavior as MySQL.
|
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: