Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25694

JSON_UNQUOTE inserts spaces.

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5.5
    • None
    • None
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            johan.wikman Johan Wikman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.