Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1
Description
JSON comparison semantics are installed only where "the extracted value participates directly in the comparison"; any function wrapping turns it into a plain string item going through sortcmp (quoted text vs bare value, not equal). Rewriting WHERE j->'$.a'='text' into the defensive WHERE COALESCE(j->'$.a','')='text' silently flips the result.
SELECT '{"a":"text"}'->'$.a' = 'text'; -- 1 (unquote semantics) |
SELECT COALESCE('{"a":"text"}'->'$.a','x') = 'text'; -- 0 (plain string comparison) |
SELECT IFNULL('{"a":"text"}'->'$.a','x') = 'text'; -- 0 |
SELECT CONCAT('{"a":"text"}'->'$.a','') = 'text'; -- 0 |
SELECT IF(1, '{"a":"text"}'->'$.a','x') = 'text'; -- 0 |
Attachments
Issue Links
- relates to
-
MDEV-27018 IF and COALESCE lose "json" property
-
- Closed
-