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

In ucs2/utf16/utf32 documents, JSON_EXTRACT and JSON_CONTAINS_PATH do not find paths that JSON_VALUE finds

    XMLWordPrintable

Details

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

    Description

      When the document argument is in a charset with mbminlen > 1, the path lookup of JSON_EXTRACT / JSON_CONTAINS_PATH fails, while JSON_VALUE on the very same arguments succeeds.

      Reproduced on 10.11.19 (debug build):

      SELECT JSON_EXTRACT(CONVERT('{"a":[1,2]}' USING ucs2), '$.a[1]'),               -- NULL
             JSON_CONTAINS_PATH(CONVERT('{"a":[1,2]}' USING ucs2), 'one', '$.a[1]'),  -- 0
             JSON_VALUE(CONVERT('{"a":[1,2]}' USING ucs2), '$.a[1]');                 -- 2
       
      SELECT JSON_EXTRACT(CONVERT('{"a":1}' USING utf32), '$.a'),                     -- NULL
             JSON_CONTAINS_PATH(CONVERT('{"a":1}' USING utf32), 'one', '$.a');        -- 0

      Expected: all three agree (2 / 1 / 2, and 1 / 1).

      Related: MDEV-34173 (character_set_connection=ucs2) and MDEV-31539 (character_set_database=ucs2) cover the connection/database charset; here the document itself is in a wide charset and the three functions disagree with each other on identical arguments.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chunlingqin chunlingqin
              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.