maybe wrong INSERT behavior when there's not null virtual column on nullable column
- 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
CREATE TABLE t0(c0 BOOL UNSIGNED , c1 DECIMAL UNSIGNED , c2 BOOL UNSIGNED ZEROFILL AS (c0) VIRTUAL NOT NULL );
CREATE TABLE t1 LIKE t0;
CREATE UNIQUE INDEX i0 ON t1(c2 DESC, c1 DESC, c0);
INSERT INTO t0(c0) VALUES (true);
INSERT IGNORE INTO t1(c1) VALUES (1);
```
``` sql
mysql> select * from t0;
+------+------+----+
| c0 | c1 | c2 |
+------+------+----+
| 1 | NULL | 1 |
+------+------+----+
1 row in set (0.01 sec)
```
``` sql
mysql> select * from t1;
+------+------+----+
| c0 | c1 | c2 |
+------+------+----+
| 0 | 1 | 0 |
+------+------+----+
1 row in set (0.01 sec)
```
### 2. What did you expect to see? (Required)
``` sql
mysql> select * from t1;
+------+------+----+
| c0 | c1 | c2 |
+------+------+----+
| NULL | 1 | 0 |
+------+------+----+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
``` sql
mysql> select * from t1;
+------+------+----+
| c0 | c1 | c2 |
+------+------+----+
| 0 | 1 | 0 |
+------+------+----+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```
tidb_version()
-----------------------------------------------------------
Release Version: v8.2.0 +
Edition: Community +
Git Commit Hash: 821e491a20fbab36604b36b647b5bae26a2c1418+
Git Branch: HEAD +
UTC Build Time: 2024-07-05 09:16:25 +
GoVersion: go1.21.10 +
Race Enabled: false +
Check Table Before Drop: false +
Store: tikv
```
Contributor guide
Assessment
This issue has not been assessed yet.