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

Wrong error message for the alter statement failure

    XMLWordPrintable

Details

    Description

      While working on the patch for MDEV-33087, reviewer (marko) wants
      me to hit the code for copy_data_between_tables() error handling part.
      In that process, I encountered the wrong message for the failed alter.

      -- source include/have_innodb.inc
       
      CREATE TABLE t1
      (
      f1 VARCHAR(32)BINARY NOT NULL,
      f2 VARCHAR(32)BINARY NOT NULL,
      PRIMARY KEY (f1),
      INDEX(f2)
      ) ENGINE=InnoDB;
      INSERT INTO t1 VALUES("MySQL", "InnoDB"), ("MariaDB", "NDB");
       
      CREATE TABLE t2
      (
      f1 VARCHAR(32)BINARY NOT NULL,
      f2 VARCHAR(255)BINARY NOT NULL,
      f3 VARCHAR(32)BINARY,
      f4 int, PRIMARY KEY (f1), INDEX(f1)
      ) ENGINE=InnoDB;
      INSERT INTO t2 VALUES("InnoDB", "InnoDB", "InnoDB", 1),
                           ("NDB", "InnoDB", "NDB", 1);
      ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t2 (f1);
      ALTER TABLE t2 ADD  FOREIGN KEY (f2) REFERENCES t2 (f2),
      ADD UNIQUE INDEX(f4);
      drop table t1, t2;
      

      Second alter statement is throwing error:

      mysqltest: At line 21: query 'ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),ADD UNIQUE INDEX(f3)'
      failed: ER_FK_CANNOT_DELETE_PARENT (1834): Cannot delete rows from table which is parent in a foreign key constraint 't1_ibfk_1' of table 't1'
      

      Alter statement was failing due to uniqueness of the column(f3), but it is throwing error which is completely different.

      Attachments

        Activity

          People

            Unassigned Unassigned
            thiru Thirunarayanan Balathandayuthapani
            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.