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

ALGORITHM=INPLACE is wrongly allowed to break data type constraints

    XMLWordPrintable

Details

    Description

      Column type changes in ALGORITHM=INPLACE should set the flag ALTER_COLUMN_TYPE (or ALTER_STORED_COLUMN_TYPE), but MariaDB fails to do that:

      --source include/have_innodb.inc
      create table a(a double) engine=innodb;
      insert into a values(1.15);
      alter table a modify a double(4,4), algorithm=copy;
      alter table a modify a double(4,4), algorithm=inplace;
      drop table a;
      

      The ALGORITHM=COPY operation would return warnings or errors.
      The ALGORITHM=INPLACE operation is wrongly executed as a schema-only change, with no warning or error.
      I debugged the execution in MariaDB 10.2, and we had ha_alter_info->handler_flags == ALTER_COLUMN_DEFAULT passed to ha_innobase::check_if_supported_inplace_alter() even though there is no change to any DEFAULT value. (InnoDB would ignore any changes to DEFAULT, because that is completely managed by the SQL layer.)

      Changing the constraints of data types should set the ALTER_COLUMN_TYPE flag, which would cause InnoDB to refuse ALGORITHM=INPLACE operation. (Note: changing the AUTO_INCREMENT attribute does this; see MDEV-12836.)

      Attachments

        Activity

          People

            Unassigned Unassigned
            marko Marko Mäkelä
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.