pingcap / pingcap/tidb

Discrepant Join Result on the same-value join condition

Open
#60,127 0 comments 0 reactions 0 assignees View on GitHub
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)

```
CREATE TABLE t0(c0 TEXT(5) );
CREATE TABLE t1(c0 TEXT(5) );

INSERT INTO t0 VALUES (' ');
INSERT INTO t1(c0) VALUES ('');

select (t0.c0 = t1.c0) from t0,t1;

SELECT *
FROM t0
INNER JOIN t1 ON (NOT (t0.c0 LIKE t1.c0));

SELECT *
FROM t0
INNER JOIN t1 ON ((t0.c0 = t1.c0) AND (NOT (t0.c0 LIKE t1.c0)));

```

### 2. What did you expect to see? (Required)
```
Q1:
1
Q2:
,
(will produce the result of t0.c0, t1.c0,)
Q3:
,
(will produce the result of t0.c0, t1.c0,)
```

### 3. What did you see instead (Required)
```
Q1:
1
Q2:
,
(will produce the result of t0.c0, t1.c0,)
Q3:
empty result
```

### 4. What is your TiDB version? (Required)
```
Release Version: v9.0.0-beta.1.pre-389-g21f9bb7b7a
Edition: Community
Git Commit Hash: 21f9bb7b7a7478d825c4dee4fbf2ce913e3e7cf1
Git Branch: HEAD
UTC Build Time: 2025-03-11 09:37:34
GoVersion: go1.23.7
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.