ADDDATE result is different in TIDB and Mysql
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
SELECT ADDDATE('8112-06-20', REPEAT('1', 32));
```
### 2. What did you expect to see? (Required)
```sql
mysql> SELECT ADDDATE('8112-06-20', REPEAT('1', 32));
+----------------------------------------+
| ADDDATE('8112-06-20', REPEAT('1', 32)) |
+----------------------------------------+
| NULL |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1441 | Datetime function: datetime field overflow |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```sql
mysql> SELECT ADDDATE('8112-06-20', REPEAT('1', 32));
+----------------------------------------+
| ADDDATE('8112-06-20', REPEAT('1', 32)) |
+----------------------------------------+
| 8112-06-20 |
+----------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '11111111111111111111111111111111' |
+---------+------+--------------------------------------------------------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```sql
| Release Version: v6.2.0-alpha-216-ged5e63a7a
Edition: Community
Git Commit Hash: ed5e63a7a0a275e313cd78ab1777e46803c2de53
Git Branch: master
UTC Build Time: 2022-06-28 20:05:37
GoVersion: go1.18
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Store: unistore |
```
Contributor guide
Assessment
This issue has not been assessed yet.