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

Array wildcard in JSON path returns incorrect results when the key is null

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 13.1
    • N/A
    • JSON
    • None
    • Not for Release Notes

    Description

      Hi,

      I found that when a JSON data has a NULL key, the array wildcard of the JSON path will return incorrect results:

      SELECT JSON_QUERY('{"a":[0,{"b":1}]}', '$.a[*]'); -- {"b":1}, expected 
      SELECT JSON_QUERY('{"a":[null,{"b":1}]}', '$.a[*]'); -- NULL, unexpected
      SELECT JSON_QUERY('{"a":[null,{"b":1}]}', '$.a[1]'); -- {"b":1}, expected
      SELECT JSON_KEY_VALUE('{"a":[0,{"b":1}]}', '$.a[*]'); -- [{"key": "b", "value": 1}], expected
      SELECT JSON_KEY_VALUE('{"a":[null,{"b":1}]}', '$.a[*]'); -- NULL, unexpected
      SELECT JSON_KEY_VALUE('{"a":[null,{"b":1}]}', '$.a[1]'); -- [{"key": "b", "value": 1}], expected
      

      Attachments

        Issue Links

          Activity

            People

              shipjain Shipra Jain
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.