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

ERROR 1025 (HY000): Error on rename of './test/t1' to './test/t2' (errno: 150 "Foreign key constraint is incorrectly formed") on RENAME

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4
    • 10.5, 10.6, 10.11
    • None

    Description

      While a few related bugs are open, I did not see any that this matched this scenario (RENAME, double ref needed).

      SET foreign_key_checks=0;
      CREATE TABLE t1 (pk INT KEY,b INT,c INT,FOREIGN KEY(b,c) REFERENCES t2 (pk,pk));
      RENAME TABLE t1 TO t2;
      

      Leads to:

      11.4.0 9bd95e914f3f12d0d9d93e7a1f2c49e6e8841f17 (Debug)

      11.4.0-dbg>RENAME TABLE t1 TO t2;
      ERROR 1025 (HY000): Error on rename of './test/t1' to './test/t2' (errno: 150 "Foreign key constraint is incorrectly formed")
      

      And in the error log:

      11.4.0 9bd95e914f3f12d0d9d93e7a1f2c49e6e8841f17 (Debug)

      [ERROR] InnoDB: In RENAME TABLE table `test`.`t2` is referenced in foreign key constraints which are not compatible with the new table definition.
      

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.