pingcap / pingcap/tidb

Unexpected Results by CAST

Open
#60,630 1 comment 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
fuzz/sqlancer severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

```sql
CREATE TABLE t0(c0 BLOB);
INSERT INTO t0 VALUES ('');
SELECT COUNT(t0.c0) FROM t0 WHERE CAST(- t0.c0 AS DATETIME) = - t0.c0; -- {1}
```

### 2. What did you expect to see? (Required)
The predicate `CAST(- t0.c0 AS DATETIME) = - t0.c0` is evaluated to `NULL`, so the result should be 0 instead of 1.

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

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

```bash
+--------------------------------------------+
| version() |
+--------------------------------------------+
| 8.0.11-TiDB-v9.0.0-beta.1.pre-563-gea52376 |
+--------------------------------------------+
```

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.