Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
If possible, provide a recipe for reproducing the error.
select convert_tz(now(),'UTC', 'Universal');
select convert_tz(now(),'utc', 'UTC');
select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
- What did you expect to see?
In Mysql
mysql> select convert_tz(now(),'UTC', 'Universal');
+--------------------------------------+
| convert_tz(now(),'UTC', 'Universal') |
+--------------------------------------+
| NULL |
+--------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz(now(),'utc', 'UTC');
+--------------------------------+
| convert_tz(now(),'utc', 'UTC') |
+--------------------------------+
| NULL |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1917-11-07 12:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1970-01-01 01:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1970-01-01 01:00:01', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-01 00:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-30 01:59:59', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-30 02:30:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-30 03:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-05-01 00:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 01:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 02:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 02:59:59', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 04:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2038-01-19 04:14:07', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2038-01-19 04:14:08', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2103-01-01 04:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| NULL |
+-------------------------------------------------+
1 row in set (0.00 sec)
- What did you see instead?
In TiDB
mysql> select convert_tz(now(),'UTC', 'Universal');
+--------------------------------------+
| convert_tz(now(),'UTC', 'Universal') |
+--------------------------------------+
| 2019-03-18 17:42:10.000000 |
+--------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz(now(),'utc', 'UTC');
+--------------------------------+
| convert_tz(now(),'utc', 'UTC') |
+--------------------------------+
| 2019-03-18 17:42:10.000000 |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1917-11-07 12:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 1917-11-07 11:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1970-01-01 01:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 1970-01-01 00:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('1970-01-01 01:00:01', 'MET', 'UTC') |
+-------------------------------------------------+
| 1970-01-01 00:00:01 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-01 00:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-02-28 23:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-30 01:59:59', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-03-30 00:59:59 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
ERROR 1292 (22007): invalid time format: '{2003 3 30 2 30 0 0}'
mysql> select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-03-30 03:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-03-30 01:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-05-01 00:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-04-30 22:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 01:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-10-25 23:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 02:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-10-26 01:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 02:59:59', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-10-26 01:59:59 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2003-10-26 04:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2003-10-26 03:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2038-01-19 04:14:07', 'MET', 'UTC') |
+-------------------------------------------------+
| 2038-01-19 03:14:07 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2038-01-19 04:14:08', 'MET', 'UTC') |
+-------------------------------------------------+
| 2038-01-19 03:14:08 |
+-------------------------------------------------+
1 row in set (0.00 sec)
mysql> select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
+-------------------------------------------------+
| convert_tz('2103-01-01 04:00:00', 'MET', 'UTC') |
+-------------------------------------------------+
| 2103-01-01 03:00:00 |
+-------------------------------------------------+
1 row in set (0.00 sec)
- What version of TiDB are you using (
tidb-server -V or run select tidb_version(); on TiDB)?
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v3.0.0-beta-227-g06183393e-dirty
Git Commit Hash: 06183393ed536aa248248b72d4bf9f5010947f66
Git Branch: master
UTC Build Time: 2019-03-15 08:22:53
GoVersion: go version go1.12 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
In Mysql
In TiDB
tidb-server -Vor runselect tidb_version();on TiDB)?