pingcap / pingcap/tidb

Datetime data type conversion is not compatible with MYSQL 8.0

Open
#44,997 0 comments 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report
Datetime data type conversion is not compatible with MYSQL 8.0.But with v5.x we are compatible with MYSQL 8.0
### 1. Minimal reproduce step (Required)
```
mysql> create table tt(name varchar(50));
mysql> insert into tt values(20221231),('');
mysql> insert into tt select * from tt where datediff(name,'20221231')<0;
```

### 2. What did you expect to see? (Required)
```
mysql> insert into tt select * from tt where datediff(name,'20221231')<0;
ERROR 1292 (22007): Incorrect datetime value: ''
```
### 3. What did you see instead (Required)
```
mysql> insert into tt select * from tt where datediff(name,'20221231')<0;
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 1

mysql> show warnings;
+---------+------+-------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------+
| Warning | 1292 | evaluation failed: Incorrect datetime value: '' |
+---------+------+-------------------------------------------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
Begin with v6.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.