-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 invalid time format #8311
Comments
Thanks for your report. @breeswish |
This now returns mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-852-g1e7454c81
Edition: Community
Git Commit Hash: 1e7454c81d1f4fae464e835d1a4023a911cfa87b
Git Branch: master
UTC Build Time: 2020-07-28 01:36:23
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)
mysql> SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central');
+------------------------------------------------------------+
| CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') |
+------------------------------------------------------------+
| NULL |
+------------------------------------------------------------+
1 row in set (0.00 sec)
|
@nullnotnil Yes, TiDB embeds time zone information by default (as other time zone related functions will work), a proper behaviour should be returning something instead of NULL. |
SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET'); -- works correctly (example from https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_convert-tz)
SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','+10:00'); -- works correctly (example from https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_convert-tz
SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','+10:00'); -- returns null, a bug
SELECT CONVERT_TZ('2004-01-01 12:00:00','+00:00','MET'); -- returns null, a bug
SELECT CONVERT_TZ('2004-01-01 12:00:00','SYSTEM','+10:00'); -- returns null, a bug, behavior different from mysql
SELECT CONVERT_TZ('2004-01-01 12:00:00','SYSTEM','MET'); -- returns null, a bug, behavior different from mysql |
The problem is here: https://github.com/pingcap/tidb/blob/master/expression/builtin_time.go#L5721-L5755 If both are timezone offsets or if both are timezone names things are fine, but when mixed it doesn't work which matches what the if statements do based on
Looking at the regex it doesn't seem to handle |
In addition to |
@dveeden I am the one who sent the original commands with comments, that reached you through multiple people :). |
Current behavior of the query in the description of this issue:
|
Bug Report
MySQL:
TiDB:
The text was updated successfully, but these errors were encountered: