pingcap / pingcap/tidb

result of replace is inconsistent with mysql

Open
#61,519 2 comments 0 reactions 0 assignees View on GitHub
sig/sql-infra 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)
```
CREATE TABLE t3 (
id INT PRIMARY KEY,
code VARCHAR(10),
UNIQUE KEY (id, code)
);
REPLACE INTO t3 VALUES (1, 'A'), (1, 'A');
```

### 2. What did you expect to see? (Required)
results from mysql
```
MySQL [fuzztest]> REPLACE INTO t3 VALUES (1, 'A'), (1, 'A');
Query OK, 3 rows affected (0.00 sec)
Records: 2 Duplicates: 1 Warnings: 0
```
### 3. What did you see instead (Required)
results from tidb
```

MySQL [test1]> REPLACE INTO t3 VALUES (1, 'A'), (1, 'A');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0

```
### 4. What is your TiDB version? (Required)

```
MySQL [test1]> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.5.6
Edition: Community
Git Commit Hash: 1ad553d6de2cb0c9b2f3cfdb760aaae109b2c466
Git Branch: HEAD
UTC Build Time: 2025-03-12 10:49:51
GoVersion: go1.21.13
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

```

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.