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

Cannot add PK when identical UNIQUE key exists

    XMLWordPrintable

Details

    Description

      Given there is an InnoDB table with no PK, and (at least) one unique key:

      CREATE TABLE test_tbl (
        col1 int(10) unsigned NOT NULL,
        UNIQUE KEY uniq (col1)
      ) ENGINE=innodb;
      

      Attempting to add a PK on the same columns:

      ALTER TABLE test_tbl ADD PRIMARY KEY(col1);
      

      Gives the following error:

      ERROR 1280 (42000): Incorrect index name 'uniq'
      

      and the PK is not created.

      This doesn't happen on latest 10.3 or latest 10.5 from dockerhub, only with 10.4

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dsech Dorian Sechesan
              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.