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

JSON_KEYS fails to deduplicate the same key when formatting the data with utf8mb4

    XMLWordPrintable

Details

    Description

      Hi,

      I found that JSON_KEYS fails to deduplicate the same key when formatting the data with utf8mb4.

      SET @plain_dup='{"a":1,"a":2}';
      SET @escaped_quote_dup=CONVERT(X'7B22615C2262223A312C22615C2262223A327D' USING utf8mb4);
       
      SELECT JSON_KEYS(@plain_dup) AS plain_keys,
             JSON_LENGTH(JSON_KEYS(@plain_dup)) AS plain_key_count; -- ["a"]   1, this is correct
       
      SELECT JSON_KEYS(@escaped_quote_dup) AS escaped_quote_keys,
             JSON_LENGTH(JSON_KEYS(@escaped_quote_dup)) AS escaped_quote_key_count; -- ["a\"b", "a\"b"]        2, JSON_KEYS fails to deduplicate this
      

      Attachments

        Activity

          People

            gkodinov Georgi Kodinov
            ChiZhang Chi Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.