Reputation: 71
I have 3 tables. The last two tables have a foreign key to the first on the same field. Both foreign keys are set to UPDATE CASCADE, DELETE CASCADE. When I delete a child-row in the second table, the parent row in the first table remains unchanged. But when I delete a child-row in the third table, the first row in the table is deleted!
Foreign keys should not behave in the same way as both daughters?
Upvotes: 4
Views: 1767
Reputation: 12749
My guess is that table 2 uses MyISAM tables (which do not support foreign keys) while the other two tables are using the InnoDB engine (which do support foreign keys).
Foreign key relationships involve a parent table that holds the central data values, and a child table with identical values pointing back to its parent. The FOREIGN KEY clause is specified in the child table. The parent and child tables must both be InnoDB tables. They must not be TEMPORARY tables.
Upvotes: 1