| Bug #59698 | Insert with NULL value for recursive constraint fails | ||
|---|---|---|---|
| Submitted: | 24 Jan 2011 15:36 | Modified: | 24 Jan 2011 16:03 |
| Reporter: | Ral Carbonneau | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S2 (Serious) |
| Version: | 5.5.8 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | Insert NULL, recursive constraint | ||
[24 Jan 2011 15:36]
Ral Carbonneau
[24 Jan 2011 15:51]
Valeriy Kravchuk
I see the following: FOREIGN KEY (`ID` ) Maybe you meant FOREIGN KEY (`ParentID` ) Please, clarify.
[24 Jan 2011 16:03]
Ral Carbonneau
Yes, you are correct, that is what was meant and it works correctly. Here is the corrected ADD CONSTRAINT and the INSERT works correctly. ALTER TABLE `test` ADD CONSTRAINT `test-ParentID` FOREIGN KEY (`ParentID` ) REFERENCES `qlplan`.`test` (`ID` ) ON DELETE RESTRICT ON UPDATE RESTRICT , ADD INDEX `test-ParentID` (`ParentID` ASC) ; INSERT INTO `test` (`ID`) VALUES (1);
