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

DNAMES: Adding a column with a too long name corrupts previously inserted data

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • 10.0.1
    • None
    • None

    Description

      First, we insert a value into column col1 (and check that it's inserted correctly). Then we add a column with a long name, and expectedly get a warning about truncated data. But then we try to read the value of 'col1' again and find out that it's not the same as it used to be.

      drop table if exists t1;
      CREATE TABLE t1 (f1 tinyblob);
      INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
      select column_get(f1,'col1' as char(30)) from t1;
      # +-----------------------------------+
      # | column_get(f1,'col1' as char(30)) |
      # +-----------------------------------+
      # | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa    |
      # +-----------------------------------+
       
      UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
      show warnings;
      # +---------+------+-----------------------------------------+
      # | Level   | Code | Message                                 |
      # +---------+------+-----------------------------------------+
      # | Warning | 1265 | Data truncated for column 'f1' at row 1 |
      # +---------+------+-----------------------------------------+
       
      select column_get(f1,'col1' as char(30)) from t1;
      # +-----------------------------------+
      # | column_get(f1,'col1' as char(30)) |
      # +-----------------------------------+
      # | aaaaaaaaaaaaaaaaaaaaaaaa¦¦¦¦¦¦          |
      # +-----------------------------------+
       
       select column_get(f1,'col1' as char(30)) = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as test from t1; 
      # +------+
      # | test |
      # +------+
      # |    0 |
      # +------+

      Test case (same as above, but only essential commands)

      drop table if exists t1;
      CREATE TABLE t1 (f1 tinyblob);
      INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
      UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
      select column_get(f1,'col1' as char(30)) from t1;

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.