Unexpected Inner join result
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Dear TiDB Developers,
I meet some unexpected join results, please see the following cases. I will appreciate it if you can review it.
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t1(c0 INT);
CREATE TABLE t3(c0 INT );
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t3(c0) VALUES (-63595);
SELECT t3.c0
FROM t3
INNER JOIN t1 ON (CASE 1
WHEN ((((t3.c0)))) THEN -10
ELSE ((((t1.c0) IS NOT NULL)) / (t3.c0)) END);
-- 2 rows
ALTER TABLE t1 ADD PRIMARY KEY (c0);
-- necessary
SELECT t3.c0
FROM t3
INNER JOIN t1 ON (CASE 1
WHEN ((((t3.c0)))) THEN -10
ELSE ((((t1.c0) IS NOT NULL)) / (t3.c0)) END);
-- empty result
```
### 2. What did you expect to see? (Required)
The two query produces same results.
### 3. What did you see instead (Required)
The two query produces different results.
### 4. What is your TiDB version? (Required)
```
Release Version: v9.0.0-beta.1.pre-801-gd7d62ce0d2
Edition: Community
Git Commit Hash: d7d62ce0d26d15b902361010aab2526a4e2c511f
Git Branch: HEAD
UTC Build Time: 2025-05-25 04:45:44
GoVersion: go1.23.9
Race Enabled: false
Check Table Before Drop: false
Store: tikv
```
Contributor guide
Assessment
This issue has not been assessed yet.