pingcap / pingcap/tidb

DELETE statement reports inconsistent error messages within and outside a transaction

Open
#54,411 1 comment 0 reactions 0 assignees View on GitHub
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
/* init */ CREATE TABLE t(c1 TEXT);

/* tx */ BEGIN;
/* tx */ INSERT IGNORE INTO t VALUES ('z');
/* tx */ DELETE FROM t WHERE t.c1 < 1; -- report an error
/* tx */ COMMIT;
```

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

DELETE statement reports an error without a transaction:
```sql
mysql> INSERT IGNORE INTO t VALUES ('z');
Query OK, 1 row affected (0.01 sec)

mysql> DELETE FROM t WHERE t.c1;
ERROR 1292 (22007): Truncated incorrect INTEGER value: 'z'
```

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

DELETE statement reports an error in a transaction:
```sql
mysql> DELETE FROM t WHERE t.c1;
ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'z'
```

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

```sql
Release Version: v6.6.0
Edition: Community
Git Commit Hash: f4ca0821fb96a2bdd37d2fb97eb26c07fc58d4e4
Git Branch: heads/refs/tags/v6.6.0
UTC Build Time: 2023-02-17 14:49:02
GoVersion: go1.19.5
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided CREATE TABLE, INSERT IGNORE, and DELETE sequence in TiDB v6.6.0, both inside and outside a transaction, and compare the diagnostics. Done means the DELETE statement reports consistent error wording in both execution contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.