pingcap / pingcap/tidb

INSERT reports error.

Open
#55,599 1 comment 0 reactions 0 assignees View on GitHub
affects-8.5 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/moderate sig/transaction type/bug
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 DECIMAL UNSIGNED ZEROFILL , c1 CHAR DEFAULT '{' , c2 FLOAT UNSIGNED AS (c0) VIRTUAL NOT NULL UNIQUE ) ;
INSERT IGNORE INTO t0(c1, c0) VALUES ('3', NULL), ('&', -679917749);
INSERT IGNORE INTO t0(c1, c0) VALUES ('2', -1665002185) ON DUPLICATE KEY UPDATE c0=t0.c1;
```

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

Statements execute successfully.

### 3. What did you see instead (Required)

```sql
mysql> INSERT IGNORE INTO t0(c1, c0) VALUES ('2', -1665002185) ON DUPLICATE KEY UPDATE c0=t0.c1;
ERROR 8141 (HY000): assertion failed: key: 748000000000006ba45f69800000000000000100038000000000000001, assertion: Exist, start_ts: 452029336601493507, existing start ts: 0, existing commit ts: 0
```
Also, when I SELECT contents in t0, MySQL and TiDB return different results.
In MySQL:
```sql
+------------+------+----+
| c0 | c1 | c2 |
+------------+------+----+
| 0000000003 | 3 | 3 |
+------------+------+----+
```
In TiDB:
```sql
mysql> select * from t0;
+------+------+----+
| c0 | c1 | c2 |
+------+------+----+
| NULL | 3 | 0 |
+------+------+----+
1 row in set (0.00 sec)

```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.4.0-alpha-21-g162cb15402
Edition: Community
Git Commit Hash: 162cb15402de471152a1e59e2ed5d8d1ffcbb4b0
Git Branch: master
UTC Build Time: 2024-08-22 08:12:28
GoVersion: go1.22.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```
tikv is set up with partitioned raft kv

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.