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

connect table truncates table column defined as an utf8 char string

    XMLWordPrintable

    Details

      Description

      After upgrading MariaDB from 10.4.12 to 10.4.21, we observed problems on existing connect tables:
      Result set fetched
      SQLWarning:

      1) Code: 1105 --- Out of range value for column col1 at row 2
      2) Code: 1366 --- Incorrect string value: '\xC3' for column `lanm2434`.`testconnect`.`col1` at row 2
      3) Code: 1105 --- Out of range value glac� for column 'col1' at row 2
      

      The query is:
      select 'testconnect' , col1, length(col1) , char_length(col1) from lanm2434.testconnect;

      Looking at the column size in bytes and chars on the table and connect table we can see difference in count for column with multi-bytes char:

      select 'testtable' , col1, length(col1)  , char_length(col1) from lanm2434.testtable 
      union
      select 'testconnect' , col1, length(col1)  , char_length(col1) from lanm2434.testconnect ;
       
      testtable    col1   length(col1)  char_length(col1)  
      -----------  -----  ------------  -----------------  
      testtable    glace  5             5                  
      testtable    glacé  6             5                  
      testconnect  glace  5             5                  
      testconnect  glac?  5             5                  
      

      And, of course, the accentuated character is not printed as bytes of the character is truncated.

      Steps to reproduce:

      CREATE TABLE `testtable` (
        `col1` char(5) 
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
       
      INSERT INTO `lanm2434`.`testtable` (`col1`) VALUES ('glace');
      INSERT INTO `lanm2434`.`testtable` (`col1`) VALUES ('glacé');
       
      CREATE or REPLACE TABLE `testconnect` ENGINE=CONNECT DEFAULT CHARSET=utf8 
      CONNECTION='mysql://lanm2434:pppppppp@hostname:3306/lanm2434/testtable' `TABLE_TYPE`='mysql';
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              monty Michael Widenius
              Reporter:
              marc.langevin@usherbrooke.ca Marc
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.