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

Some JSON functions print the output as NULL/incorrect when character-sets is set with mbminlen > 1

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4, 11.5
    • 10.5, 10.6, 10.11, 11.1, 11.2, 11.4
    • JSON
    • None

    Description

      JSON_EXTRACT function prints the output as NULL when setting character sets with mbminlen > 1

      Character sets with mbminlen > 1

      11.5.0-dbg>set character_set_connection=ucs2;
      Query OK, 0 rows affected (0.000 sec)
      

      Actual result

      11.5.0-dbg>SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
      +---------------------------------------+
      | JSON_EXTRACT('{"a": 1,"b": 2}','$.a') |
      +---------------------------------------+
      | NULL                                  |
      +---------------------------------------+
      1 row in set, 1 warning (0.000 sec)
       
      11.5.0-dbg>
      

      Expected result

      11.5.0-dbg>SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
      +---------------------------------------+
      | JSON_EXTRACT('{"a": 1,"b": 2}','$.a') |
      +---------------------------------------+
      | 1                                     |
      +---------------------------------------+
      1 row in set (0.000 sec)
       
      11.5.0-dbg>
      

      Character sets with mbminlen = 1

      11.5.0-dbg>set character_set_connection=utf8;
      Query OK, 0 rows affected (0.000 sec)
       
      11.5.0-dbg>SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
      +---------------------------------------+
      | JSON_EXTRACT('{"a": 1,"b": 2}','$.a') |
      +---------------------------------------+
      | 1                                     |
      +---------------------------------------+
      1 row in set (0.000 sec)
       
      11.5.0-dbg>
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ramesh Ramesh Sivaraman
              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.