Bug #119385 After replacing the expressions inside BETWEEN ... AND with constants, the results become inconsistent.
Submitted: 13 Nov 9:41
Reporter: Go Yakult Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.41 OS:Any
Assigned to: CPU Architecture:Any

[13 Nov 9:41] Go Yakult
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);