[MDEV-20773] Error from UPDATE when estimating selectivity of a range Created: 2019-10-08  Updated: 2023-06-20  Resolved: 2023-04-12

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Optimizer
Affects Version/s: 10.4.9, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.11.3, 11.0.2, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Critical
Reporter: Jérôme Brauge Assignee: Igor Babaev
Resolution: Fixed Votes: 1
Labels: not-11.0
Environment:

Centos 7


Attachments: File MDEV-20773.sql    
Issue Links:
Relates

 Description   

An update fails after update statistics on the table with error :
ERROR 1406 (22001): Data too long for column 'fldgapfl' at row 1



 Comments   
Comment by Alice Sherepa [ 2019-10-08 ]

Thanks a lot for the report!
Reproducible on the current 10.4:

create table t1 (a1 varchar(30) collate utf8_bin, a2 varchar(30) collate utf8_bin);
insert into t1 values('1','1'),('1','1'),('1','1'),('1','1');
 
analyze table t1 persistent for all;
update t1 set a2 = 2 where a1 like 'xx%' and exists (select 1 from t1);

10.4 c3394870303090e3e58

MariaDB [test]> create table t1 (a1 varchar(30) collate utf8_bin, a2 varchar(30) collate utf8_bin);
Query OK, 0 rows affected (0.036 sec)
 
MariaDB [test]> insert into t1 values('1','1'),('1','1'),('1','1'),('1','1');
Query OK, 4 rows affected (0.006 sec)
Records: 4  Duplicates: 0  Warnings: 0
 
MariaDB [test]> analyze table t1 persistent for all;
+---------+---------+----------+-----------------------------------------+
| Table   | Op      | Msg_type | Msg_text                                |
+---------+---------+----------+-----------------------------------------+
| test.t1 | analyze | status   | Engine-independent statistics collected |
| test.t1 | analyze | status   | OK                                      |
+---------+---------+----------+-----------------------------------------+
2 rows in set (0.031 sec)
 
MariaDB [test]> update t1 set a2 = 2 where a1 like 'xx%' and exists (select 1 from t1);
ERROR 1406 (22001): Data too long for column 'a1' at row 2
 
MariaDB [test]> update t1 set a2 = 2 where a1 like 'x%' and exists (select 1 from t1);
Query OK, 0 rows affected, 1 warning (0.001 sec)
Rows matched: 0  Changed: 0  Warnings: 1
 
Note (Code 1265): Data truncated for column 'a1' at row 2

Comment by Oleksandr Byelkin [ 2023-04-12 ]

OK to push

Comment by Igor Babaev [ 2023-04-12 ]

A fix of this bug was pushed into 10.4. It should be merged upstream as it is.

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