Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.1(EOL), 11.2, 11.4, 11.6, 11.5(EOL)
-
None
Description
CREATE TABLE t (c1 INT KEY,c2 INT,FOREIGN KEY(c2) REFERENCES t (c1) ON DELETE CASCADE) ENGINE=InnoDB; |
INSERT INTO t VALUES (0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); |
DELETE FROM t; |
Leads to:
11.5.0 e4afa610539ae01164485554e2de839bea9de816 (Debug) |
11.5.0-dbg>CREATE TABLE t (c1 INT KEY,c2 INT,FOREIGN KEY(c2) REFERENCES t (c1) ON DELETE CASCADE) ENGINE=InnoDB;
|
Query OK, 0 rows affected (0.012 sec)
|
|
11.5.0-dbg>INSERT INTO t VALUES (0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
|
Query OK, 16 rows affected (0.004 sec)
|
Records: 16 Duplicates: 0 Warnings: 0
|
|
11.5.0-dbg>DELETE FROM t;
|
ERROR 1296 (HY000): Got error 193 '`test`.`t`, CONSTRAINT `t_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t` (`c1`) ON DELETE CASCADE' from InnoDB
|
11.5.0 e4afa610539ae01164485554e2de839bea9de816 (Debug) |
2024-06-15 14:57:23 4 [ERROR] InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15. Please drop excessive foreign constraints and try again
|
If the "max depth of 15" self-referencing error is not considered to be a bug, then we can improve the CLI error.
Attachments
Issue Links
- relates to
-
MDEV-15199 Triangular FKs - Cascade delete causes broken referential integrity
- Closed
-
MDEV-22361 Cross-engine foreign keys support
- Open