[MDEV-26722] connect table truncates table column defined as an utf8 char string Created: 2021-09-29  Updated: 2022-11-11  Resolved: 2022-10-31

Status: Closed
Project: MariaDB Server
Component/s: Plugins, Storage Engine - Connect
Affects Version/s: 10.4.21, 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Marc Assignee: Andrew Hutchings
Resolution: Duplicate Votes: 1
Labels: None
Environment:

Linux RH8


Issue Links:
Duplicate
duplicates MDEV-28489 The Cyrillic string is not truncated ... Closed

 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';



 Comments   
Comment by Marc [ 2021-10-05 ]

Hi, have you been able to reproduce the problem? Need any other information?

Comment by Alice Sherepa [ 2021-10-06 ]

Thank you, I could repeat it on current 10.2-10.6, regression since 10.2.37
test for mtr (run from connect suite) :

-- source include/have_innodb.inc
 
set names utf8;
let $PORT= select @@port;
 
CREATE TABLE t1 ( col1 char(5)) engine=innodb DEFAULT charset=utf8;
INSERT INTO t1 (col1) VALUES ('glace');
INSERT INTO t1 (col1) VALUES ('glacé');
select * from t1;
 
--eval CREATE  TABLE t2 ENGINE=CONNECT DEFAULT CHARSET=utf8 TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=$PORT'
 
SHOW CREATE TABLE t2;
SELECT * FROM t2;

Comment by Marc [ 2022-01-20 ]

Hi,

Any information when this will be fixed?

Regards,

Marc

Comment by long.skinny.boy [ 2022-05-08 ]

Hmm, it looks like I have a similar problem MDEV-28489

It seems to me that the problem started with the updated version Connect 1.07.0002.
Because there is no problem in 10.5.8, but in 10.5.9 there is, and accordingly there is in 10.6.0, 10.4.18, etc.

Comment by Andrew Hutchings [ 2022-10-31 ]

Closing this one as a duplicate. It is the same problem and I included the test for this ticket in the fix for the other one.

Generated at Thu Feb 08 09:47:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.