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

Error from UPDATE when estimating selectivity of a range

Details

    Description

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

      Attachments

        Activity

          alice Alice Sherepa added a comment - - edited

          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
          
          

          alice Alice Sherepa added a comment - - edited 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

          OK to push

          sanja Oleksandr Byelkin added a comment - OK to push
          igor Igor Babaev added a comment -

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

          igor Igor Babaev added a comment - A fix of this bug was pushed into 10.4. It should be merged upstream as it is.

          People

            igor Igor Babaev
            halfspawn Jérôme Brauge
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.