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

Incorrect result of JSON_OBJECT_FILTER_KEYS

    XMLWordPrintable

Details

    Description

      Hi,

      I found that JSON_OBJECT_FILTER_KEYS can return incorrect results. This is an example:

      CREATE TABLE t(doc JSON, keys_json JSON);
      INSERT INTO t VALUES
        ('{"a":1,"b":2}', '["a"]'),
        ('{"a":1,"b":2}', '["b"]');
       
      SELECT JSON_OBJECT_FILTER_KEYS('{"a":1,"b":2}', '["a"]'); -- {"a": 1}
      SELECT JSON_OBJECT_FILTER_KEYS('{"a":1,"b":2}', '["b"]'); -- {"b": 2}
       
      SELECT keys_json, JSON_OBJECT_FILTER_KEYS(doc, keys_json) AS filtered
      FROM t ORDER BY keys_json; -- ["a"]   NULL, ["b"]   NULL
      

      Attachments

        Issue Links

          Activity

            People

              danblack Daniel Black
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 1d Remaining Estimate - 1.5d
                  1.5d
                  Logged:
                  Time Spent - 1d Remaining Estimate - 1.5d
                  1d

                  Git Integration

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