pingcap/tidb

TiDB is not compatible with MySQL 5.7 when using incomplete DateTime format

Open

#22 088 ouverte le 30 déc. 2020

Voir sur GitHub
 (8 commentaires) (0 réactions) (0 assignés)Go (6 186 forks)batch import
help wantedtype/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

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

MySQL [test]> create table t_d (id int,c1 datetime);
Query OK, 0 rows affected (1.05 sec)

MySQL [test]> insert into t_d (id,c1) values (1,'2020-01-02'),(2,'2020-02-02');
Query OK, 2 rows affected (0.03 sec)
Records: 2  Duplicates: 0  Warnings: 0

MySQL [test]> select * from t_d where c1 > '2020-01';
Empty set, 1 warning (0.01 sec)

MySQL [test]> select * from t_d where c1 > '2020-01-01';
+------+---------------------+
| id   | c1                  |
+------+---------------------+
|    1 | 2020-01-02 00:00:00 |
|    2 | 2020-02-02 00:00:00 |
+------+---------------------+
2 rows in set (0.00 sec)

2. What did you expect to see? (Required)

Just like MySQL

Database changed
MySQL [test]> create table t_d (id int,c1 datetime);
Query OK, 0 rows affected (0.02 sec)

MySQL [test]>  insert into t_d (id,c1) values (1,'2020-01-02'),(2,'2020-02-02');
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

MySQL [test]> select * from t_d where c1 > '2020-01';
+------+---------------------+
| id   | c1                  |
+------+---------------------+
|    1 | 2020-01-02 00:00:00 |
|    2 | 2020-02-02 00:00:00 |
+------+---------------------+
2 rows in set, 1 warning (0.00 sec)

MySQL [test]> select @@version;
+-----------------+
| @@version       |
+-----------------+
| 5.6.48-88.0-log |
+-----------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

Nothing returned in TiDB

MySQL [test]> select * from t_d where c1 > '2020-01';
Empty set, 1 warning (0.01 sec)

4. What is your TiDB version? (Required)

MySQL [test]> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                     |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.8
Edition: Community
Git Commit Hash: 66ac9fc31f1733e5eb8d11891ec1b38f9c422817
Git Branch: heads/refs/tags/v4.0.8
UTC Build Time: 2020-10-30 08:21:16
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)

Guide contributeur