mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy alter from creating invalid FK structure
Problem: ======== - InnoDB should have two keys on the same column for the self referencing foreign key relation. Solution: ========= - Allow self referential foreign key relation to work with one key.
This commit is contained in:
@ -85,10 +85,8 @@ SET FOREIGN_KEY_CHECKS= ON;
|
||||
CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB;
|
||||
--error ER_CANT_CREATE_TABLE
|
||||
CREATE TABLE t3 (a INT) ENGINE=InnoDB;
|
||||
--replace_result $datadir ./
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 RENAME TO t3;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t3 FORCE;
|
||||
--error ER_TRUNCATE_ILLEGAL_FK
|
||||
TRUNCATE TABLE t1;
|
||||
DROP TABLE t2, t1;
|
||||
TRUNCATE TABLE t3;
|
||||
DROP TABLE t2, t3;
|
||||
|
Reference in New Issue
Block a user