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

CREATE OR REPLACE fails to recreate same constraint name

Details

    Description

      CREATE OR REPLACE failed with "Duplicate key on write or update" when it replace an empty table with the non-anonymous constraint name

      From comment
      Test fails due to a duplicate key on SYS_FOREIGN.NAME on the non-anonymous constraint name:

      Test:

      --source include/have_innodb.inc
       
      CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
      CREATE OR REPLACE TABLE u(a INT PRIMARY KEY, CONSTRAINT c FOREIGN KEY d (a) REFERENCES t (a)) ENGINE=InnoDB;
      CREATE OR REPLACE TABLE u(a INT PRIMARY KEY, CONSTRAINT c FOREIGN KEY d (a) REFERENCES t (a)) ENGINE=InnoDB;
      DROP TABLE u, t;
      

      Actual result:

      At line 5: query 'CREATE OR REPLACE TABLE u(a INT PRIMARY KEY, CONSTRAINT c FOREIGN KEY d (a) REFERENCES t (a)) ENGINE=InnoDB' failed: ER_CANT_CREATE_TABLE (1005): Can't create table `test`.`u` (errno: 121 "Duplicate key on write or update")
      

      Expected result:
      No errors

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Aleksey Midenkov made transition -
            Open In Progress
            4d 4h 24m 1
            Aleksey Midenkov made transition -
            Stalled In Review
            6h 45m 1
            Aleksey Midenkov made transition -
            Stalled In Progress
            12d 23h 31m 5
            Aleksey Midenkov made transition -
            In Progress In Review
            8d 6h 2m 6
            Marko Mäkelä made transition -
            In Review Stalled
            43d 2h 14m 7
            Sergei Golubchik made transition -
            Stalled In Testing
            1m 7s 1
            Aleksey Midenkov made transition -
            In Testing Closed
            89d 1h 26m 1
            Sergei Golubchik made transition -
            Closed Stalled
            692d 23h 20m 2
            Aleksey Midenkov made transition -
            Stalled Closed
            86d 1h 46m 2

            People

              midenok Aleksey Midenkov
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.