Bug #119815 An incorrect results after inserting a record

Submitted: 31 Jan 7:03 Modified: 31 Jan 21:10
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

[31 Jan 7:03] fan liu
Description:
The same SQL statement returned different results after I inserted a single record. The condition in the WHERE clause was equivalent to t0.c0 = t2.c0. After I converted it to an equivalent condition, it returned the correct result.

SELECT * FROM t2, t0 WHERE (IF(NULL, "TRUE", t0.c0)) = (t2.c0); 
c0         |c0         |c1       |
-----------+-----------+---------+
-1219280000|-1219280000|-76957127|

INSERT INTO t2(c0) VALUES(-1087353144);
SELECT * FROM t2, t0 WHERE (IF(NULL, "TRUE", t0.c0)) = (t2.c0); 
c0|c0|c1|
--+--+--+

SELECT * FROM t2, t0 WHERE t0.c0 = t2.c0; 
c0         |c0         |c1       |
-----------+-----------+---------+
-1219280000|-1219280000|-76957127|

How to repeat:
DROP DATABASE IF EXISTS test;  
CREATE DATABASE  test;  
USE test;  
CREATE TABLE t0(c0 FLOAT , c1 DOUBLE )  ENGINE = ARCHIVE;  
CREATE TABLE t2(c0 FLOAT UNIQUE) ENGINE = MEMORY;  
REPLACE INTO t2(c0) VALUES(-1219282247);
INSERT DELAYED INTO t0(c0,c1) VALUES( -1.219282247E9, -76957127); 	
SELECT * FROM t2, t0 WHERE (IF(NULL, "TRUE", t0.c0)) = (t2.c0); 
INSERT INTO t2(c0) VALUES(-1087353144);
SELECT * FROM t2, t0 WHERE (IF(NULL, "TRUE", t0.c0)) = (t2.c0); 
SELECT * FROM t2, t0 WHERE t0.c0 = t2.c0;
[31 Jan 21:10] Roy Lyseng
Thank you for the bug report.
Verified as described.

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

Page generated in 0.048 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.