Bug #117235 Unexpected results when using JSON_ARRAY comparison as a predicate.

Submitted: 18 Jan 2025 7:00 Modified: 20 Jan 2025 6:04
Reporter: wang jack Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:8.4.1,9.1.0, 8.0.40, 8.4.3 OS:Windows
Assigned to: CPU Architecture:x86

[18 Jan 2025 7:00] wang jack
Description:
From my understanding, the first query below should return 1 row, but it is actually return empty.

mysql> SELECT ALL t0.c0 FROM t0 WHERE (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= (("1") IS NOT FALSE); -- empty
Empty set (0.00 sec)

mysql>
mysql> select (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= (("1") IS NOT FALSE) from t0; -- {1}
+-------------------------------------------------------------+
| (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= (("1") IS NOT FALSE) |
+-------------------------------------------------------------+
|                                                           1 |
+-------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT ALL t0.c0 FROM t0 WHERE (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= true;                 -- 1 row
+-----------+
| c0        |
+-----------+
| 733219734 |
+-----------+
1 row in set (0.00 sec)

How to repeat:
DROP TABLE IF EXISTS t0;
CREATE TABLE IF NOT EXISTS t0(c0 int) ;
INSERT INTO t0(c0) VALUES(733219734);

SELECT ALL t0.c0 FROM t0 WHERE (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= (("1") IS NOT FALSE); -- empty

select (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= (("1") IS NOT FALSE) from t0; -- {1}
SELECT ALL t0.c0 FROM t0 WHERE (JSON_ARRAY(((((t0.c0)^(t0.c0)))))) <= true;                 -- 1 row
[20 Jan 2025 6:04] MySQL Verification Team
Hello wang jack,

Thank you for the report and test case.
Verified as described.

regards,
Umesh

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

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