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

DESC attribute is ignored when index is re-created within single ALTER on InnoDB table

    XMLWordPrintable

Details

    Description

      --source include/have_innodb.inc
       
      create or replace table t (pk int primary key, i int, key idx(i)) engine=InnoDB;
      show create table t;
      alter table t drop key idx, add key idx(i desc);
      show create table t;
       
      # This works:
      alter table t drop key idx;
      alter table t add key idx(i desc);
      show create table t;
       
      # Cleanup
      drop table t;
      

      preview-10.8-MDEV-13756-desc-indexes 383b51d68

      alter table t drop key idx, add key idx(i desc);
      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `pk` int(11) NOT NULL,
        `i` int(11) DEFAULT NULL,
        PRIMARY KEY (`pk`),
        KEY `idx` (`i`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      

      Not reproducible with MyISAM, Aria.

      When the two ALTERs are executed separately, it works:

      alter table t drop key idx;
      alter table t add key idx(i desc);
      show create table t;
      Table	Create Table
      t	CREATE TABLE `t` (
        `pk` int(11) NOT NULL,
        `i` int(11) DEFAULT NULL,
        PRIMARY KEY (`pk`),
        KEY `idx` (`i` DESC)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              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.