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

Unexpected error when create table with SELECT JSON_KEY_VALUE

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4, 11.8, 12.3, 13.1
    • 11.8, 12.3, 13.0.1
    • JSON
    • None

    Description

      Hi,

      The following test case triggers an unexpected error `ERROR 1406 (22001) at line 8: Data too long for column 'c' at row 1`, however, the length of row 1 is only 53:

      SELECT JSON_KEY_VALUE('{"a":1,"b":22}', '$') AS direct_value,
             CHAR_LENGTH(JSON_KEY_VALUE('{"a":1,"b":22}', '$')) AS direct_len;
      -- [{"key": "a", "value": 1}, {"key": "b", "value": 22}]   53
       
      CREATE TABLE t_key AS
      SELECT JSON_KEY_VALUE('{"a":1,"b":22}', '$') AS c;
      -- ERROR 1406 (22001) at line 8: Data too long for column 'c' at row 1
      

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            ChiZhang Chi Zhang
            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.