Bug #91245 | json column wtih integer value got incorrect result | ||
---|---|---|---|
Submitted: | 14 Jun 2018 2:08 | Modified: | 14 Jun 2018 5:29 |
Reporter: | chen kris | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: JSON | Severity: | S2 (Serious) |
Version: | 5.7.19, 5.7.22, 8.0.11 | OS: | MacOS |
Assigned to: | CPU Architecture: | Any |
[14 Jun 2018 2:08]
chen kris
[14 Jun 2018 5:28]
MySQL Verification Team
Hello chen kris, Thank you for the report and test case. Thanks, Umesh
[25 Jun 2024 13:20]
Daniƫl van Eeden
Not sure this is actually a bug. Looks like the types don't match. mysql-8.4.0> select * from testjson where JSON_EXTRACT(jdoc,'$.key1') IN ("1") ; Empty set (0.01 sec) mysql-8.4.0> select * from testjson where JSON_EXTRACT(jdoc,'$.key1') IN (1) ; +-------------------------+ | jdoc | +-------------------------+ | {"key1": 1, "key2": 11} | +-------------------------+ 1 row in set (0.00 sec) mysql-8.4.0> select * from testjson where CAST(JSON_EXTRACT(jdoc,'$.key1') AS CHAR) IN ("1") ; +-------------------------+ | jdoc | +-------------------------+ | {"key1": 1, "key2": 11} | +-------------------------+ 1 row in set (0.00 sec) mysql-8.4.0> select * from testjson where JSON_EXTRACT(jdoc,'$.key1') IN (CAST("1" AS JSON)) ; +-------------------------+ | jdoc | +-------------------------+ | {"key1": 1, "key2": 11} | +-------------------------+ 1 row in set (0.00 sec)