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

Drop of non-existing FK succeeds for temporary table

Details

    Description

      --source include/have_innodb.inc
       
      CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB;
      INSERT INTO t VALUES (1);
      ALTER TABLE t DROP FOREIGN KEY fk;
       
      # Cleanup
      DROP TABLE t;
      

      10.3 77951dd7

      CREATE TEMPORARY TABLE t (a INT, KEY(a)) ENGINE=InnoDB;
      INSERT INTO t VALUES (1);
      ALTER TABLE t DROP FOREIGN KEY fk;
      DROP TABLE t;
      

      So, although there is no foreign key fk (or any other), ALTER succeeds.
      Reproducible on all current version lines of MariaDB and on MySQL 5.7. Not reproducible on MySQL 8.0.

      Attachments

        Activity

          According to marko,

          The culprit should be outside InnoDB, because ALTER TABLE on temporary tables always goes through the ALGORITHM=COPY route.

          elenst Elena Stepanova added a comment - According to marko , The culprit should be outside InnoDB, because ALTER TABLE on temporary tables always goes through the ALGORITHM=COPY route.

          I do not think that temporary tables ever supported FOREIGN KEY constraints in InnoDB, not even when they were actually persistent tables (before InnoDB in MySQL 5.7 and MariaDB 10.2 stopped writing any log for them).

          marko Marko Mäkelä added a comment - I do not think that temporary tables ever supported FOREIGN KEY constraints in InnoDB, not even when they were actually persistent tables (before InnoDB in MySQL 5.7 and MariaDB 10.2 stopped writing any log for them).

          And yet, adding an invalid FK to a temporary InnoDB table causes typical "incorrectly formed" errors (unlike adding the same to a MyISAM table, which truly doesn't care). So if it's unsupported, it's inconsistently unsupported.

          elenst Elena Stepanova added a comment - And yet, adding an invalid FK to a temporary InnoDB table causes typical "incorrectly formed" errors (unlike adding the same to a MyISAM table, which truly doesn't care). So if it's unsupported, it's inconsistently unsupported.

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            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.