Menu

#183 Foreign key double-specified

open
nobody
5
2010-04-28
2010-04-28
Martin H
No

This table DDL is wrong because the foreign key hostID is referenced twice. It throws a MySQL error 150 (bad foreign key).

ALTER TABLE `asset_NessusStats`
ADD FOREIGN KEY (`hostID`) REFERENCES `assets` (`hostID`) ON DELETE NO ACTION,
ADD FOREIGN KEY (`accessRating`) REFERENCES `lookup_AccessRating` (`id`) ON DELETE NO ACTION,
ADD FOREIGN KEY (`reportID`) REFERENCES `scan_Reports` (`reportID`) ON DELETE NO ACTION,
ADD FOREIGN KEY (`hostID`) REFERENCES `assets` (`hostID`) ON DELETE CASCADE;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB