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

Incorrect error when dropping and adding back a column that is indexed

    XMLWordPrintable

Details

    Description

      Dropping and adding a column that is included in an index fails if this is done in a single ALTER statement, even though it works fine if it's first dropped in one ALTER and then added back in a second ALTER statement.

      Additionally, the error message is inapplicable.

      Steps to reproduce:

      DROP TABLE IF EXISTS `example`;
       
      CREATE TABLE `example` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `a` int(11) NOT NULL,
        `b` datetime DEFAULT NULL,
        PRIMARY KEY (`id`),
        KEY `c` (`a`,`b`) USING BTREE
      ) ENGINE=InnoDB;
       
      ALTER TABLE example DROP `b`, ADD `b` datetime;
      

      produces

      ERROR 1089 (HY000) at line 12: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys

      Attachments

        Activity

          People

            Unassigned Unassigned
            will.bryant Will Bryant
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.