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

        Activity

          People

            rucha174 Rucha Deodhar
            ChiZhang Chi Zhang
            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.