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

Field type conversion warnings have changed to worse

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2
    • 10.2
    • Data types
    • None
    • 351026ca535179abb956c5ad1e1d59aac0835254

    Description

      The following SQL fragment converts CHAR field to INT:

      --source include/have_innodb.inc
       
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT, b CHAR(8)) ENGINE=InnoDB;
      INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
      ALTER TABLE t1 MODIFY b INT DEFAULT 5;
       
      DROP TABLE t1;
      

      It used to produce warnings like this:

      Warnings:
      Warning 1366    Incorrect integer value: 'a' for column 'b' at row 1
      Warning 1366    Incorrect integer value: 'b' for column 'b' at row 2
      Warning 1366    Incorrect integer value: 'c' for column 'b' at row 3
      

      Now on 10.2 it produces warnings like this:

      Warnings:
      Warning 1292    Truncated incorrect INTEGER value: 'a       '
      Warning 1292    Truncated incorrect INTEGER value: 'b       '
      Warning 1292    Truncated incorrect INTEGER value: 'c       '
      

      It changed with this commit:

      commit 454589b67f9609a78f00e521fe2ef0994eed4f3f
      Author: Alexander Barkov <bar@mariadb.org>
      Date:   Mon Jan 11 17:20:16 2016 +0400
       
          MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
          
          Also fixes:
          MDEV-9391 InnoDB does not produce warnings when doing WHERE int_column=varchar_column
          MDEV-9337 ALTER from DECIMAL and INT to DATETIME returns a wrong result
          MDEV-9340 Copying from INT/DOUBLE to ENUM is inconsistent
          MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
      

      Old warnings look more meaningful, as they show the row number and column name, not just the value; I wonder if it's possible not to lose them.

      Note: while reproducing, take into account MDEV-9704 – if it's not fixed yet, use MTR rather than MySQL client.

      Attachments

        Activity

          People

            bar Alexander Barkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.