Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.9.3, 10.9(EOL), 10.10(EOL)
-
Ubuntu Server 22.04.1 LTS, MariaDB 10.9 installed from official MariaDB repositories.
Description
10.9 doesn't seem to be handling special characters in JSON keys in JSON_VALUE and JSON_EXTRACT functions - it returns NULL even when the key is quoted according to the documentation:
."memberName" - the same as above but allows one to select a member with a name that's not a valid identifier (that is, has space, dot, and/or other characters)
This has changed in 10.9 - 10.8 works as expected (I don't have any earlier version to test against.)
In 10.8.4:
Welcome to the MariaDB monitor. Commands end with ; or \g. |
Server version: 10.8.4-MariaDB-1:10.8.4+maria~ubu2004-log mariadb.org binary distribution |
|
MariaDB [(none)]> SET @test = '{"NetworkManager":"1:1.36.0-7.el8_6","NetworkManager-initscripts-updown":"1:1.36.0-7.el8_6"}'; |
Query OK, 0 rows affected (0.000 sec) |
|
|
MariaDB [(none)]> SELECT JSON_VALUE(@test, '$."NetworkManager"'); |
+-----------------------------------------+ |
| JSON_VALUE(@test, '$."NetworkManager"') | |
+-----------------------------------------+ |
| 1:1.36.0-7.el8_6 |
|
+-----------------------------------------+ |
1 row in set (0.003 sec) |
|
|
MariaDB [(none)]> SELECT JSON_VALUE(@test, '$."NetworkManager-initscripts-updown"'); |
+------------------------------------------------------------+ |
| JSON_VALUE(@test, '$."NetworkManager-initscripts-updown"') | |
+------------------------------------------------------------+ |
| 1:1.36.0-7.el8_6 |
|
+------------------------------------------------------------+ |
1 row in set (0.000 sec) |
In 10.9.2 and 10.9.3, the final query returns NULL:
Welcome to the MariaDB monitor. Commands end with ; or \g. |
Server version: 10.9.3-MariaDB-1:10.9.3+maria~ubu2204-log mariadb.org binary distribution |
|
MariaDB [(none)]> SET @test = '{"NetworkManager":"1:1.36.0-7.el8_6","NetworkManager-initscripts-updown":"1:1.36.0-7.el8_6"}'; |
Query OK, 0 rows affected (0.000 sec) |
|
|
MariaDB [(none)]> SELECT JSON_VALUE(@test, '$."NetworkManager"'); |
+-----------------------------------------+ |
| JSON_VALUE(@test, '$."NetworkManager"') | |
+-----------------------------------------+ |
| 1:1.36.0-7.el8_6 |
|
+-----------------------------------------+ |
1 row in set (0.000 sec) |
|
|
MariaDB [(none)]> SELECT JSON_VALUE(@test, '$."NetworkManager-initscripts-updown"'); |
+------------------------------------------------------------+ |
| JSON_VALUE(@test, '$."NetworkManager-initscripts-updown"') | |
+------------------------------------------------------------+ |
| NULL | |
+------------------------------------------------------------+ |
1 row in set (0.000 sec) |
Attachments
Issue Links
- duplicates
-
MDEV-29381 JSON paths containing dashes are reported as syntax errors in procedures
- Closed
- is caused by
-
MDEV-22224 Support JSON Path negative index
- Closed
- is duplicated by
-
MDEV-30060 JSON path expression with dashes doesn't work
- Closed
- relates to
-
MDEV-32007 JSON_VALUE and JSON_EXTRACT doesn't handle dash (-) as first character in key
- Closed