Omgå MySQL bug?
Sakset fra http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html :Deviation from SQL standards: If ON UPDATE CASCADE or ON UPDATE SET NULL recurses to update the same table it has previously updated during the cascade, it acts like RESTRICT. This means that you cannot use self-referential ON UPDATE CASCADE or ON UPDATE SET NULL operations. This is to prevent infinite loops resulting from cascaded updates. A self-referential ON DELETE SET NULL, on the other hand, is possible, as is a self-referential ON DELETE CASCADE. Cascading operations may not be nested more than 15 levels deep.
Når man i MySQL ikke kan bruge constraints til samme table, hvad kan man så gøre hvis man f.eks. vil lave én kategori-tabel som her:
CREATE TABLE `cat` (
`id` int(11) auto_increment,
`title` varchar(100),
`description` text,
`parent` int(11),
PRIMARY KEY (`id`),
UNIQUE KEY `title` (`title`)
) ENGINE=InnoDB;
Kan man overhovedet omgå den bug fornuftigt?