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

ALTER TABLE gives false reason for refusing to instantly drop primary key

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
      create or replace table t1 (a int, b int, primary key(a)) engine=InnoDB;
      --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
      alter table t1 drop primary key, algorithm=instant;
      alter table t1 drop primary key, add primary key(b), algorithm=instant;
      

      10.5 69077dea25

      MariaDB [test]> create or replace table t1 (a int, b int, primary key(a)) engine=InnoDB;
      Query OK, 0 rows affected (1.101 sec)
       
      MariaDB [test]> alter table t1 drop primary key, algorithm=instant;
      ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY
       
      MariaDB [test]> alter table t1 drop primary key, add primary key(b), algorithm=instant;
      ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
      

      Apparently in the first case it means to say that the primary key has to be on the same column, but it doesn't say that.

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.