Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.2(EOL), 11.4
-
None
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
Issue Links
- is duplicated by
-
MDEV-34728 incorrect error message: Cannot delete rows from table which is parent in a foreign key constraint
- Closed