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

ROW_NUMBER is not set and differs from the message upon WARN_DATA_TRUNCATED produced by inplace ALTER

    XMLWordPrintable

    Details

      Description

      --source include/have_innodb.inc
       
      create or replace table t (a varchar(64)) engine=InnoDB;
      insert into t values ('foo'),(null);
      --error WARN_DATA_TRUNCATED
      alter table t add primary key(a), algorithm=INPLACE;
       
      get diagnostics condition 1 @n= row_number, @m= message_text;
      select @n, @m;
      

      Note: algorithm=INPLACE is default for this ALTER, I only specify it for clarity.

      bb-10.7-row_number cb9002bee

      MariaDB [test]> get diagnostics condition 1 @n= row_number, @m= message_text; select @n, @m;
      Query OK, 0 rows affected (0.000 sec)
       
      +------+----------------------------------------+
      | @n   | @m                                     |
      +------+----------------------------------------+
      |    0 | Data truncated for column 'a' at row 2 |
      +------+----------------------------------------+
      1 row in set (0.000 sec)
      

      If the algorithm is set to COPY (or if the table is MyISAM, then COPY is default), then ROW_NUMBER is set as expected.

      There are likely to be many places where inplace ALTER bypasses ROW_NUMBER initialization; the problem here is that the value ends up to be different from the error message.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rucha174 Rucha Deodhar
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration