Bug #117127 Query results do not meet expectations when the predicate involves CASE WHEN and LIKE

Submitted: 8 Jan 2025 5:38 Modified: 8 Jan 2025 7:36
Reporter: wang jack Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.4.1, 8.0.40 OS:Windows (windows 11)
Assigned to: CPU Architecture:x86 (x86_64)

[8 Jan 2025 5:38] wang jack
Description:
From my understanding, the first query below should return one row of data, but the result is empty.

mysql> SELECT TRUE FROM t2 WHERE ((FALSE) > (t2.c2)) LIKE CASE WHEN TRUE THEN TRUE ELSE 0.6094693825270517 END;
Empty set (0.00 sec)

mysql> SELECT (((FALSE)) > (t2.c2)) LIKE CASE WHEN TRUE THEN TRUE ELSE 0.6094693825270517 END FROM t2;
+---------------------------------------------------------------------------------+
| (((FALSE)) > (t2.c2)) LIKE CASE WHEN TRUE THEN TRUE ELSE 0.6094693825270517 END |
+---------------------------------------------------------------------------------+
|                                                                               1 |
+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
DROP TABLE IF EXISTS t2;
CREATE TABLE IF NOT EXISTS t2(c2 LONGTEXT) ;
INSERT INTO t2(c2) VALUES("-401933063");

SELECT (((FALSE)) > (t2.c2)) LIKE CASE WHEN TRUE THEN TRUE ELSE 0.6094693825270517 END FROM t2; -- {1}
SELECT TRUE FROM t2 WHERE ((FALSE) > (t2.c2)) LIKE CASE WHEN TRUE THEN TRUE ELSE 0.6094693825270517 END; -- empty
[8 Jan 2025 7:36] MySQL Verification Team
Hello wang jack,

Thank you for the report and test case.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.