Bug #119741 internal_tmp_mem_storage_engine = MEMORY setting makes the DISTINCTROW returns incorrect result on 0 and -0
Description:
Hi,
In the following test case, there are two equivalent queries, the normal SELECT returns 0 and -0 for ref0, while the prepared SELECT only returns 0. If I remove the `SET SESSION internal_tmp_mem_storage_engine = MEMORY;`, then both queries only return `0`.
```
CREATE TABLE t0(c1 DOUBLE ) ;
SET SESSION internal_tmp_mem_storage_engine = MEMORY;
INSERT INTO t0(c1) VALUES(-0.0), ("-0.0");
ref0 ref2
0 0
-0 0
SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1))));
SET @a = 0.8;
SET @b = 0.8;
PREPARE prepare_query FROM "SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1))))";
EXECUTE prepare_query USING @a,@b;
ref0 ref2
0 0
```
How to repeat:
```
CREATE TABLE t0(c1 DOUBLE ) ;
SET SESSION internal_tmp_mem_storage_engine = MEMORY;
INSERT INTO t0(c1) VALUES(-0.0), ("-0.0");
SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1))));
SET @a = 0.8;
SET @b = 0.8;
PREPARE prepare_query FROM "SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1))))";
EXECUTE prepare_query USING @a,@b;
```
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 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.
Description: Hi, In the following test case, there are two equivalent queries, the normal SELECT returns 0 and -0 for ref0, while the prepared SELECT only returns 0. If I remove the `SET SESSION internal_tmp_mem_storage_engine = MEMORY;`, then both queries only return `0`. ``` CREATE TABLE t0(c1 DOUBLE ) ; SET SESSION internal_tmp_mem_storage_engine = MEMORY; INSERT INTO t0(c1) VALUES(-0.0), ("-0.0"); ref0 ref2 0 0 -0 0 SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))); SET @a = 0.8; SET @b = 0.8; PREPARE prepare_query FROM "SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1))))"; EXECUTE prepare_query USING @a,@b; ref0 ref2 0 0 ``` How to repeat: ``` CREATE TABLE t0(c1 DOUBLE ) ; SET SESSION internal_tmp_mem_storage_engine = MEMORY; INSERT INTO t0(c1) VALUES(-0.0), ("-0.0"); SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(0.8 AS DOUBLE)) LIKE (t0.c1)))); SET @a = 0.8; SET @b = 0.8; PREPARE prepare_query FROM "SELECT DISTINCTROW t0.c1 AS ref0, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1)))) AS ref2 FROM t0 GROUP BY t0.c1, ('a') NOT IN ((- ((CAST(? AS DOUBLE)) LIKE (t0.c1))))"; EXECUTE prepare_query USING @a,@b; ```