[MDEV-25694] JSON_UNQUOTE inserts spaces. Created: 2021-05-17  Updated: 2021-05-17

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.5.5
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Johan Wikman Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Consider this:

MariaDB [test]> select json_extract('{"a": { "b": "1234" }}', '$.a');
+-----------------------------------------------+
| json_extract('{"a": { "b": "1234" }}', '$.a') |
+-----------------------------------------------+
| {"b": "1234"}                                 |
+-----------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> select json_compact(json_extract('{"a": { "b": "1234" }}', '$.a'));
+-------------------------------------------------------------+
| json_compact(json_extract('{"a": { "b": "1234" }}', '$.a')) |
+-------------------------------------------------------------+
| {"b":"1234"}                                                |
+-------------------------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> select json_unquote(json_compact(json_extract('{"a": { "b": "1234" }}', '$.a')));
+---------------------------------------------------------------------------+
| json_unquote(json_compact(json_extract('{"a": { "b": "1234" }}', '$.a'))) |
+---------------------------------------------------------------------------+
| {"b": "1234"}                                                             |
+---------------------------------------------------------------------------+
1 row in set (0.000 sec)

Note the added space after the colon (:). Considering that the documentation states:

If the given value is not a JSON string, value is passed through unmodified.

json_unquote should not do that.


Generated at Thu Feb 08 09:39:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.