Bug #119385 After replacing the expressions inside BETWEEN ... AND with constants, the results become inconsistent.
Description:
mysql> SELECT DISTINCT t0.c0 AS ref0, t0.c7 AS ref1,t0.c1 FROM t0 WHERE t0.c1 is false and t0.c7 BETWEEN (1) AND (1);
Empty set (0.00 sec)
mysql> select false IS NOT TRUE;
+-------------------+
| false IS NOT TRUE |
+-------------------+
| 1 |
+-------------------+
1 row in set (0.00 sec)
mysql> SELECT DISTINCT t0.c0 AS ref0, t0.c7 AS ref1,t0.c1 FROM t0 WHERE t0.c1 is false and t0.c7 BETWEEN (1) AND (false IS NOT TRUE);
+------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ref0 | ref1 | c1 |
+------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| NULL | 1.00000000 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
+------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
How to repeat:
DROP TABLE IF EXISTS `t0`;
CREATE TABLE `t0` (
`c0` double DEFAULT NULL ,
`c1` mediumint(253) unsigned zerofill DEFAULT NULL ,
`c2` tinyint NOT NULL ,
`c3` int DEFAULT NULL,
`c7` float(8,8) DEFAULT NULL ,
`c8` decimal(10,0) DEFAULT NULL
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
INSERT INTO `t0` (`c0`, `c1`, `c2`, `c3`, `c7`, `c8`) VALUES (NULL,0,-96,NULL,1.00000000,0);
SELECT DISTINCT t0.c0 AS ref0, t0.c7 AS ref1,t0.c1 FROM t0 WHERE t0.c1 is false and t0.c7 BETWEEN (1) AND (1);
SELECT DISTINCT t0.c0 AS ref0, t0.c7 AS ref1,t0.c1 FROM t0 WHERE t0.c1 is false and t0.c7 BETWEEN (1) AND (false IS NOT TRUE);
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.