`CROSS JOIN` and `LEFT JOIN ON TRUE` return inconsistent results with `LIKE` predicate
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
A CROSS JOIN (comma join) and a LEFT JOIN with `ON TRUE` produce inconsistent results for the same WHERE predicate. `SELECT * FROM t0, t1` and `SELECT * FROM t0 LEFT JOIN t1 ON TRUE` should be semantically equivalent, but they return different result sets.
### 1. Minimal reproduce step (Required)
```sql
DROP DATABASE IF EXISTS testdb;
CREATE DATABASE testdb;
USE testdb;
CREATE TABLE t0(c0 DECIMAL);
CREATE TABLE t1 LIKE t0;
INSERT INTO t0 VALUES (1);
INSERT INTO t1 SELECT * FROM t0;
SELECT * FROM t0, t1 WHERE 0 LIKE (t1.c0 * t1.c0 % 1);
SELECT * FROM t0 LEFT JOIN t1 ON TRUE WHERE 0 LIKE (t1.c0 * t1.c0 % 1);
```
### 2. What did you expect to see? (Required)
`SELECT * FROM t0, t1` (CROSS JOIN) and `SELECT * FROM t0 LEFT JOIN t1 ON TRUE` are semantically equivalent — both produce the Cartesian product of `t0` and `t1`. With the same WHERE predicate, both queries should return the same result set.
```sql
mysql> SELECT * FROM t0, t1 WHERE 0 LIKE (t1.c0 * t1.c0 % 1);
+------+------+
| c0 | c0 |
+------+------+
| 1 | 1 |
+------+------+
1 row in set
```
The LEFT JOIN query should also return `{(1, 1)}`.
### 3. What did you see instead (Required)
```sql
mysql> SELECT * FROM t0 LEFT JOIN t1 ON TRUE WHERE 0 LIKE (t1.c0 * t1.c0 % 1);
Empty set
```
The LEFT JOIN query incorrectly returns an empty set, while the equivalent CROSS JOIN returns `{(1, 1)}`.
### 4. What is your TiDB version? (Required)
```
Release Version: v8.5.6
Edition: Community
Git Commit Hash: ae18096e023780bb56bfce33698abec0d4640d0a
Git Branch: HEAD
UTC Build Time: 2026-06-04 05:49:11
GoVersion: go1.25.8
Race Enabled: false
Check Table Before Drop: false
Store: unistore
```
Contributor guide
Assessment
This issue has not been assessed yet.