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

json_table does not respect unicode escapes in a json string

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.18, 11.4.2
    • 10.6, 10.11, 11.1, 11.2, 11.4
    • JSON
    • None
    • Windows 10

    Description

      When using json strings generated from PHP by default the queries don't work properly. This appears to be a valid JSON string per the standards and some of the documentation suggests it should work but it doesn't.

      Sample script:

      drop table if exists test;
      create table test (col varchar(100));
      insert into test values('string');
      insert into test values('noël');
       
      SELECT *                                
      FROM json_table(
      	'[\"no\u00ebl\", \"string\"]',
        '$[*]' COLUMNS(`jsoncol` VARCHAR(500) PATH '$' ERROR ON ERROR)
      ) AS `json`
      INNER JOIN `test` ON `test`.`col` = `json`.`jsoncol`;
       
      SELECT *                                
      FROM json_table(
      	'[\"noël\", \"string\"]',
        '$[*]' COLUMNS(`jsoncol` VARCHAR(500) PATH '$' ERROR ON ERROR)
      ) AS `json`
      INNER JOIN `test` ON `test`.`col` = `json`.`jsoncol`;
      

      These queries should product the same results matching both rows but the first only matches the "string" value that does not have unicode characters.

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            kevinrsours Kevin Sours
            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.