Details
-
Bug
-
Status: In Testing (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8.5
-
None
Description
When using the output of JSON_EXTRACT as an expression in IF(expr, ...), the result has changed between 11.4 and 11.8. I'm wondering if this is an undocumented change (I can update the upgrade guide) or a bug.
SELECT
|
VERSION() AS version,
|
JSON_TYPE(JSON_EXTRACT(x.val, '$.booleanValue')) AS json_type, |
JSON_EXTRACT(x.val, '$.booleanValue') AS value, |
IF(JSON_EXTRACT(x.val, '$.booleanValue'), 1, 0) AS value_if, |
(JSON_EXTRACT(x.val, '$.booleanValue') = true) AS value_eq |
FROM (
|
SELECT '{"booleanValue": true}' AS val |
UNION ALL
|
SELECT '{"booleanValue": false}' AS val |
) AS x;
|
Results in these values on version 11.4 vs 11.8:
| Version | type | value | if | eq |
| 11.4.9-MariaDB-ubu2404 | BOOLEAN | true | 1 | 1 |
| 11.4.9-MariaDB-ubu2404 | BOOLEAN | false | 0 | 0 |
| 11.8.5-MariaDB-ubu2404 | BOOLEAN | true | 0 | 1 |
| 11.8.5-MariaDB-ubu2404 | BOOLEAN | false | 0 | 0 |
NB: The query can be changed to use
JSON_EXTRACT() = true |
instead as noted in the reproduction.