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

            Unassigned Unassigned
            ChiZhang Chi Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Remaining Estimate - 0.5d
                0.5d
                Logged:
                Time Spent - Not Specified
                Not Specified

                Git Integration

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