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

ALGORITHM=INPLACE is wrongly allowed to break data type constraints

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

          marko Marko Mäkelä created issue -
          marko Marko Mäkelä made changes -
          Field Original Value New Value
          Status Open [ 1 ] Confirmed [ 10101 ]
          marko Marko Mäkelä made changes -
          Fix Version/s 10.2 [ 14601 ]
          Fix Version/s 10.3 [ 22126 ]
          Fix Version/s 10.1 [ 16100 ]
          marko Marko Mäkelä made changes -
          Labels alter ddl types alter ddl types upstream
          serg Sergei Golubchik made changes -
          Fix Version/s 10.4 [ 22408 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.0 [ 16000 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.1 [ 16100 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 85556 ] MariaDB v4 [ 144019 ]
          ralf.gebhardt Ralf Gebhardt made changes -
          Fix Version/s 10.2 [ 14601 ]
          julien.fritsch Julien Fritsch made changes -
          Fix Version/s 10.3 [ 22126 ]

          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.