Bug #119145 INNER JOIN and INTERSECT of LEFT/RIGHT JOINs return different results with complex boolean conditions
Submitted: 13 Oct 12:53
Reporter: Ye Shiyang Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version: 8.4.6 OS:Any (windows )
Assigned to: CPU Architecture:Any (x64)
Tags: INNER_JOIN, LEFT_JOIN, RIGHT_JOIN

[13 Oct 12:53] Ye Shiyang
Description:
In MySQL 8.4.6, an INNER JOIN query and an INTERSECT of LEFT JOIN and RIGHT JOIN queries with identical complex boolean conditions return different results. This violates the mathematical equivalence that should exist between these query patterns.

How to repeat:
CREATE TABLE IF NOT EXISTS t0(c0 DECIMAL);
CREATE TABLE t1 LIKE t0;

REPLACE INTO t0(c0) VALUES(834093548);
INSERT LOW_PRIORITY IGNORE INTO t1(c0) VALUES('G');
REPLACE DELAYED INTO t0(c0) VALUES(0.9039790036861364);

-- First query (returns 2 rows)
SELECT DISTINCT t0.c0, t1.c0 FROM t0 INNER JOIN t1 ON (EXISTS (SELECT 1 WHERE FALSE)) | ((t1.c0) <= ((- (0.880450067708653))));

-- Second query (returns empty, should match first query)
(SELECT t0.c0, t1.c0 FROM t0 LEFT JOIN t1 ON (EXISTS (SELECT 1 WHERE FALSE)) | ((t1.c0) <= ((- (0.880450067708653))))) 
INTERSECT 
(SELECT t0.c0, t1.c0 FROM t0 RIGHT JOIN t1 ON (EXISTS (SELECT 1 WHERE FALSE)) | ((t1.c0) <= ((- (0.880450067708653)))));