Bug #119834 Inconsistent query results when selecting different columns with the same JOIN condition involving LIKE (EXISTS(subquery
Submitted: 2 Feb 13:44 Modified: 3 Feb 13:20
Reporter: fan liu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0.44 OS:Any
Assigned to: CPU Architecture:Any

[2 Feb 13:44] fan liu
Description:
I found a query execution inconsistency in MySQL where two semantically identical SELECT statements return different results.
The only difference between the two queries is the SELECT list, while the FROM, JOIN, and ON conditions are exactly the same.

SELECT t1.c1 FROM t1 INNER JOIN t0 ON (t0.c0) LIKE ( EXISTS (SELECT 1));  
c1 |
---+
127|
SELECT t1.c1,t0.c0  FROM t1 INNER JOIN t0 ON (t0.c0) LIKE ( EXISTS (SELECT 1)); 
Empty set (0 rows)

How to repeat:
DROP DATABASE IF EXISTS test;  
CREATE DATABASE  test;  
USE test;   
CREATE TABLE `t0` (
  `c0` tinytext,
  KEY `i2` (`c0`(1))
) ENGINE=MyISAM ;
CREATE TABLE `t1` (
  `c0` decimal(10,0) DEFAULT NULL,
  `c1` tinyint  DEFAULT NULL,
  `c2` decimal(10,0) DEFAULT NULL
) ENGINE=MEMORY ;

INSERT IGNORE INTO t1(c1) VALUES(127);  
INSERT IGNORE INTO t0(c0) VALUES(795212044);  
REPLACE INTO t0(c0) VALUES(1937691733);  

SELECT t1.c1 FROM t1 INNER JOIN t0 ON (t0.c0) LIKE ( EXISTS (SELECT 1));  

SELECT t1.c1,t0.c0  FROM t1 INNER JOIN t0 ON (t0.c0) LIKE ( EXISTS (SELECT 1));
[3 Feb 13:20] Roy Lyseng
Thank you for the bug report.
Verified as described.