Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
11.0.2
-
None
-
MariaDB 11.0.2 running on MacOS; installed using homebrew
Description
11.0.2 doesn't seem to handle dashes when supplied as the first character of the JSON key. In JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is provided using the expected quoting.
CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS |
SELECT '{ "-1234" : "something", "12-34" : "else", "1234-" : "and", "1234" : "match" }' AS 'message' |
;
|
|
SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, |
JSON_SEARCH(message, 'one', 'else') AS t2_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, |
JSON_SEARCH(message, 'one', 'and') AS t3_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, |
JSON_SEARCH(message, 'one', 'match') AS t4_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result |
FROM jsonTest |
;
|
t1_path | t1_result | t2_path | t2_result | t3_path | t3_result | t4_path | t4_result |
---|---|---|---|---|---|---|---|
"$.-1234" | NULL | "$.12-34" | else | "$.1234-" | and | "$.1234" | match |
Referencing related tickets that don't quite solve this scenario.
Attachments
Issue Links
- relates to
-
MDEV-29381 JSON paths containing dashes are reported as syntax errors in procedures
-
- Closed
-
-
MDEV-29586 JSON_VALUE and JSON_EXTRACT doesn't handle special characters
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue blocks |
Link |
This issue blocks |
Description |
11.0.2 doesn't seem to handle dashes when supplied as the first character of the JSON key. In JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is provided using the expected quoting.
{code:sql} CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS SELECT '{ "-1234" : "something", "12-34" : "else", "1234-" : "and", "1234" : "match" }' AS 'message' ; SELECT * FROM jsonTest; DROP TABLE IF EXISTS jsonTest; SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, JSON_SEARCH(message, 'one', 'else') AS t2_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, JSON_SEARCH(message, 'one', 'and') AS t3_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, JSON_SEARCH(message, 'one', 'match') AS t4_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result FROM jsonTest ; {code} || t1_path || t1_result || t2_path || t2_result || t3_path || t3_result || t4_path || t4_result | | "$.-1234" | NULL | "$.12-34" | else | "$.1234-" | and | "$.1234" | match | Referencing related tickets that don't quite solve this scenario. |
11.0.2 doesn't seem to handle dashes when supplied as the first character of the JSON key. In JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is provided using the expected quoting.
{code:sql} CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS SELECT '{ "-1234" : "something", "12-34" : "else", "1234-" : "and", "1234" : "match" }' AS 'message' ; SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, JSON_SEARCH(message, 'one', 'else') AS t2_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, JSON_SEARCH(message, 'one', 'and') AS t3_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, JSON_SEARCH(message, 'one', 'match') AS t4_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result FROM jsonTest ; {code} || t1_path || t1_result || t2_path || t2_result || t3_path || t3_result || t4_path || t4_result | | "$.-1234" | NULL | "$.12-34" | else | "$.1234-" | and | "$.1234" | match | Referencing related tickets that don't quite solve this scenario. |
Link |
This issue relates to |
Link |
This issue relates to |
Link |
This issue blocks |
Link |
This issue blocks |
Summary | JSON_VALUE and JSON_EXTRACT doesn't dash (-) as first character in key | JSON_VALUE and JSON_EXTRACT doesn't handle dash (-) as first character in key |
Description |
11.0.2 doesn't seem to handle dashes when supplied as the first character of the JSON key. In JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is provided using the expected quoting.
{code:sql} CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS SELECT '{ "-1234" : "something", "12-34" : "else", "1234-" : "and", "1234" : "match" }' AS 'message' ; SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, JSON_SEARCH(message, 'one', 'else') AS t2_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, JSON_SEARCH(message, 'one', 'and') AS t3_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, JSON_SEARCH(message, 'one', 'match') AS t4_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result FROM jsonTest ; {code} || t1_path || t1_result || t2_path || t2_result || t3_path || t3_result || t4_path || t4_result | | "$.-1234" | NULL | "$.12-34" | else | "$.1234-" | and | "$.1234" | match | Referencing related tickets that don't quite solve this scenario. |
11.0.2 doesn't seem to handle dashes when supplied as the first character of the JSON key. In JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is provided using the expected quoting.
{code:sql} CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS SELECT '{ "-1234" : "something", "12-34" : "else", "1234-" : "and", "1234" : "match" }' AS 'message' ; SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, JSON_SEARCH(message, 'one', 'else') AS t2_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, JSON_SEARCH(message, 'one', 'and') AS t3_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, JSON_SEARCH(message, 'one', 'match') AS t4_path, JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result FROM jsonTest ; {code} || t1_path || t1_result || t2_path || t2_result || t3_path || t3_result || t4_path || t4_result | | "$.-1234" | NULL | "$.12-34" | else | "$.1234-" | and | "$.1234" | match | Referencing related tickets that don't quite solve this scenario. |
Fix Version/s | 11.0 [ 28320 ] |
Assignee | Rucha Deodhar [ rucha174 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Testing [ 10301 ] |
Status | In Testing [ 10301 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Assignee | Rucha Deodhar [ rucha174 ] | Alexey Botchkov [ holyfoot ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Alexey Botchkov [ holyfoot ] | Rucha Deodhar [ rucha174 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 11.0.4 [ 29021 ] | |
Fix Version/s | 11.0 [ 28320 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Fix Version/s | 11.1.3 [ 29023 ] | |
Fix Version/s | 11.2.2 [ 29035 ] |
Fix Version/s | 11.0.5 [ 29520 ] | |
Fix Version/s | 11.1.4 [ 29024 ] | |
Fix Version/s | 11.2.3 [ 29521 ] | |
Fix Version/s | 11.0.4 [ 29021 ] | |
Fix Version/s | 11.1.3 [ 29023 ] | |
Fix Version/s | 11.2.2 [ 29035 ] |
patch: https://github.com/MariaDB/server/commit/9973c6d0898b3369869ec9ee8d84068c8e9c4111