pingcap / pingcap/tidb

[Cascades] Unexpected query results when tidb_enable_cascades_planner is enabled

Open
#65,669 2 comments 0 reactions 0 assignees View on GitHub
contribution first-time-contributor severity/minor sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Query results are inconsistent when switching _**tidb_enable_cascades_planner**_ between **ON** and **OFF**. I suspect there is a logic error in the Cascades Planner.

### 1. Minimal reproduce step (Required)

```
USE database3;
CREATE TABLE t3(c0 CHAR , PRIMARY KEY(c0));
INSERT INTO t3 VALUES ('-');
SET SESSION tidb_enable_cascades_planner = OFF;
SELECT t3.c0 FROM t3;
SET SESSION tidb_enable_cascades_planner = ON;
SELECT t3.c0 FROM t3;
```

### 2. What did you expect to see? (Required)
```
mysql> SELECT t3.c0 FROM t3;
+----+
| c0 |
+----+
| - |
+----+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```
mysql> SELECT t3.c0 FROM t3;
Empty set (0.00 sec)
```
### 4. What is your TiDB version? (Required)

```
mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.4
Edition: Community
Git Commit Hash: e4e814fdc0afe9c3a6e5e96f129d83df802ab820
Git Branch: HEAD
UTC Build Time: 2025-11-26 15:53:39
GoVersion: go1.23.12
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.