pingcap/tidb

Different results of time()

Open

#11.866 aperta il 26 ago 2019

Vedi su GitHub
 (8 commenti) (0 reazioni) (1 assegnatario)Go (6186 fork)batch import
challenge-programcomponent/expressiongood first issuehelp wantedpriority/P3severity/moderatesig/executiontype/bugtype/compatibility

Metriche repository

Star
 (40.090 star)
Metriche merge PR
 (Merge medio 14g 4h) (346 PR mergiate in 30 g)

Descrizione

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

Guida contributor