TiDB "ERROR 1292" lacks column information compared to 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)
```
MySQL [test]> desc ttt1;
+-------+-------------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+------+---------+-------+
| id | bigint(20) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+------+---------+-------+
2 rows in set (0.01 sec)
MySQL [test]> insert into ttt1(id,name) select '','A';
ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
MySQL [test]> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.1.0
Edition: Community
Git Commit Hash: 945d07c5d5c7a1ae212f6013adfb187f2de24b23
Git Branch: HEAD
UTC Build Time: 2024-05-21 03:51:57
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
```
### 2. What did you expect to see? (Required)
Consistent with Mysql Error
```
MySQL [test]> desc ttt1;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | bigint(20) | YES | | NULL | |
| name | varchar(10) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
MySQL [test]> insert into ttt1(id,name) select '','A';
ERROR 1366 (HY000): Incorrect integer value: '' for column 'id' at row 1
MySQL [test]> select version();
+-----------+
| version() |
+-----------+
| 5.7.44 |
+-----------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
No column information
```
ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
```
### 4. What is your TiDB version? (Required)
```
MySQL [test]> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v8.1.0
Edition: Community
Git Commit Hash: 945d07c5d5c7a1ae212f6013adfb187f2de24b23
Git Branch: HEAD
UTC Build Time: 2024-05-21 03:51:57
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
```
Contributor guide
Research direction
No source file or test is named. Start by reproducing the INSERT on TiDB v8.1.0 and comparing its error with MySQL; then trace the error-generation path and existing compatibility tests. Done means the TiDB error identifies the affected column and matches the expected MySQL-compatible behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100