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

Key column 'a' doesn't exist in table on ALTER after creating UNIQUE INDEX

    XMLWordPrintable

    Details

      Description

      USE test;
      CREATE TABLE IF NOT EXISTS t (a INT, b INT);
      CREATE UNIQUE INDEX i USING BTREE ON t(b, a);
      ALTER TABLE t DROP a;
      

      Leads to:

      10.5.6 1c587481966abc7a9ad5309d0a91ca920f7a5657 (Optimized)

      10.5.6>USE test;
      Database changed
      10.5.6>CREATE TABLE IF NOT EXISTS t (a INT, b INT);
      Query OK, 0 rows affected (0.011 sec)
      10.5.6>CREATE UNIQUE INDEX i USING BTREE ON t(b, a);
      Query OK, 0 rows affected (0.008 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      10.5.6>ALTER TABLE t DROP a;
      ERROR 1072 (42000): Key column 'a' doesn't exist in table
      

      Same result for InnoDB, MyISAM, Aria. Same result on debug build.

      Same on these versions/revisions:
      10.2.34 unknown_build_rev
      10.3.25 bafc5c1321a7dff5f2da292111bf98fed9d1658d
      10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03

      10.1.47 (Optimized)

      10.1.47>ALTER TABLE t DROP a;
      Query OK, 0 rows affected (0.04 sec)               
      Records: 0  Duplicates: 0  Warnings: 0
      

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            Roel Roel Van de Paar
            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.