Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.4, 11.8, 12.2
-
None
Description
Hi,
In the following test case, there are two equivalent queries, one is a normal SELECT and the other is a prepared SELECT. However, these two queries have different results. The normal SELECT returns 0 on all data, but the prepared SELECT returns 1. I believe the prepared statement returns unexpected results as the left operator of IN is not in the t1.c0.
CREATE TABLE t1(c0 BIGINT UNSIGNED UNIQUE, c1 REAL); |
INSERT INTO t1 VALUES (2077795537, 1654315062); |
INSERT INTO t1 VALUES (0, 1503042352); |
SELECT (- CAST(1096867228 AS DECIMAL)) IN ((SELECT t1.c0 FROM t1 WHERE t1.c1)) FROM t1; |
-- 0
|
-- 0
|
SET @a = 1096867228; |
PREPARE prepare_query FROM 'SELECT (- CAST(? AS DECIMAL)) IN ((SELECT t1.c0 FROM t1 WHERE t1.c1)) FROM t1'; |
EXECUTE prepare_query USING @a; |
-- 1
|
-- 1 |
If I remove the UNIQUE keyword of t1, the prepared SELECT can return correct result.