pingcap / pingcap/tidb

Unexpected behavior of IS NULL computation in DELETE

Open
#34,177 1 comment 0 reactions 0 assignees View on GitHub
severity/moderate sig/execution 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)

```
/* init */ DROP TABLE IF EXISTS t;
/* init */ CREATE TABLE t (c1 VARCHAR(14));
/* init */ INSERT IGNORE INTO t(c1) VALUES ('test');

DELETE FROM t WHERE (CAST(('123abc') AS DOUBLE)) IS NULL;
```

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

In MySQL 8
```
mysql> DELETE FROM t WHERE (CAST(('123abc') AS DOUBLE)) IS NULL;
Query OK, 0 rows affected (0.00 sec)
```

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

```
tidb> DELETE FROM t WHERE (CAST(('123abc') AS DOUBLE)) IS NULL;
ERROR 1292 (22007): Truncated incorrect INTEGER value: '123abc'
```

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

```
+--------------------+
| version() |
+--------------------+
| 5.7.25-TiDB-v6.0.0 |
+--------------------+
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.