pingcap / pingcap/tidb

Inconsistent warnings reported when executed within and outside the transaction

Open
#64,403 1 comment 0 reactions 0 assignees View on GitHub
contribution 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 */ DROP TABLE IF EXISTS t;
/* init */ CREATE TABLE t (c1 TEXT);

-- not in transaction
/* s */ INSERT t (c1) VALUES('Vpl');
/* s */ DELETE IGNORE FROM t WHERE ROUND(COT(c1)); -- [1]

-- in transaction
/* t1 */ BEGIN;
/* t1 */ INSERT t (c1) VALUES('Vpl');
/* t1 */ DELETE IGNORE FROM t WHERE ROUND(COT(c1)); -- [2]
```

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

The warnings reported by the DELETE statements [1] and [2] are the same.

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

The DELETE statements [1] and [2] report different warnings.

[1] DELETE not in a transaction:
```sql
mysql> INSERT t (c1) VALUES('Vpl');
Query OK, 1 row affected (0.01 sec)

mysql> DELETE IGNORE FROM t WHERE ROUND(COT(c1));
ERROR 1690 (22003): DOUBLE value is out of range in 'cot(0)'
mysql> SHOW WARNINGS;
+-------+------+------------------------------------------+
| Level | Code | Message |
+-------+------+------------------------------------------+
| Error | 1690 | DOUBLE value is out of range in 'cot(0)' |
+-------+------+------------------------------------------+
1 row in set (0.00 sec)
```
[2] DELETE in a transaction:
```sql
mysql> BEGIN;
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT t (c1) VALUES('Vpl');
Query OK, 1 row affected (0.02 sec)

mysql> DELETE IGNORE FROM t WHERE ROUND(COT(c1));
ERROR 1690 (22003): DOUBLE value is out of range in 'cot(0)'
mysql> SHOW WARNINGS;
+---------+------+------------------------------------------+
| Level | Code | Message |
+---------+------+------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'Vpl' |
| Error | 1690 | DOUBLE value is out of range in 'cot(0)' |
+---------+------+------------------------------------------+
2 rows in set (0.00 sec)
```

### 4. What is your TiDB version? (Required)
```sql
Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:43
GoVersion: go1.23.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```

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.