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

JSON_VALUE returns NULL for a key with an empty string value rather than an empty string

    XMLWordPrintable

Details

    • Unexpected results
    • Correct return value of JSON_VALUE which in the previous release, incorrectly converted a valid empty string return value to a NULL. This has been reverted to correct behaviour.

    Description

      Given the following JSON object:

      SET @jobject = JSON_OBJECT("a", "");
      

      When querying the value of key "a", up to MariaDB 10.11.13 we get an empty string:

      MariaDB [(none)]> SELECT @@VERSION, JSON_VALUE(@jobject, '$.a') AS j_value;
      +----------------------+---------+
      | @@VERSION            | j_value |
      +----------------------+---------+
      | 10.11.13-MariaDB-log |         |
      +----------------------+---------+
      1 row in set (0.000 sec)
      

      Now, with MariaDB 10.11.14 we get NULL:

      MariaDB [(none)]> SELECT @@VERSION, JSON_VALUE(@jobject, '$.a') AS j_value;
      +----------------------+---------+
      | @@VERSION            | j_value |
      +----------------------+---------+
      | 10.11.14-MariaDB-log | NULL    |
      +----------------------+---------+
      1 row in set (0.000 sec)
      

      The same change applies for JSON objects stored in a tables.

      Since the release notes of 10.11.14 do not mention any changes for the JSON component related to this change, I suspect this to be a bug, not a bug fix.

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              mmessmer Martin Messmer
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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