pingcap/tidb

Different results of time()

Open

#11 866 ouverte le 26 août 2019

Voir sur GitHub
 (8 commentaires) (0 réactions) (1 assigné)Go (6 186 forks)batch import
challenge-programcomponent/expressiongood first issuehelp wantedpriority/P3severity/moderatesig/executiontype/bugtype/compatibility

Métriques du dépôt

Stars
 (40 090 stars)
Métriques de merge PR
 (Merge moyen 14j 4h) (346 PRs mergées en 30 j)

Description

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.
select time("10:11:1212");
select time("-1? 10:11:12");
  • Need to refine ParseDuration in types/time.go
  1. What did you expect to see?
mysql> select time("10:11:1212");
+--------------------+
| time("10:11:1212") |
+--------------------+
| NULL               |
+--------------------+
1 row in set, 1 warning (0.00 sec)

mysql> select time("-1? 10:11:12");
+----------------------+
| time("-1? 10:11:12") |
+----------------------+
| -00:00:01            |
+----------------------+
1 row in set, 1 warning (0.00 sec)

Note: according to https://dev.mysql.com/doc/refman/5.7/en/time.html The first result should be 00:00:00 insteal of NULL 3. What did you see instead?

mysql> select time("10:11:1212");
+--------------------+
| time("10:11:1212") |
+--------------------+
| 10:11:12           |
+--------------------+
1 row in set (0.00 sec)

mysql> select time("-1? 10:11:12");
+----------------------+
| time("-1? 10:11:12") |
+----------------------+
| -10:11:12            |
+----------------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> select tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                                  |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.0-alpha-119-ge8597cd03
Git Commit Hash: e8597cd0398e9ef3fc71803271270c179cd1fb7d
Git Branch: fix_time
UTC Build Time: 2019-08-26 05:04:46
GoVersion: go version go1.12.4 linux/amd64
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

SIG slack channel

#sig-exec

Score

  • 300

Mentor

  • @qw4990

Guide contributeur