Bug #15627 | DatabaseMetaData getImportedKeysnot returning RESTRICT | ||
---|---|---|---|
Submitted: | 9 Dec 2005 10:52 | Modified: | 20 Dec 2005 20:41 |
Reporter: | Adam Raybone | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 3.1.12 | OS: | Windows (MS Server 2003) |
Assigned to: | CPU Architecture: | Any |
[9 Dec 2005 10:52]
Adam Raybone
[9 Dec 2005 13:50]
Mark Matthews
Thank you for taking the time to report a problem. Unfortunately you are not using a current version of the product your reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/ If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of MySQL. Additional info: Please try with version 3.1.12, 3.1.8 is quite old.
[9 Dec 2005 15:06]
Adam Raybone
Hi Mark, I downloaded MySQL 5.0 and connector J 3.1.12 and run the test again, I am still getting the value 3 (no action) for update and delete rules when examining a foreign key with ON UPADATE RESTRICT ON DELETE RESTRICT
[11 Dec 2005 14:57]
Vasily Kishkin
Thanks for the bug report. I was able to reproduce the bug: DatabaseMetaData Constant Value For importedKeyNoAction = 3 DatabaseMetaData Constant Value For importedKeyRestrict = 1 I tested on 3.1.12. My test case is attached.
[11 Dec 2005 14:58]
Vasily Kishkin
Test case
Attachment: Bug15627.class (application/octet-stream, text), 1.85 KiB.
[20 Dec 2005 20:41]
Mark Matthews
The driver is only reporting the metadata the server reports. The server says you've got "NO ACTION" for those foreign keys (from "SHOW CREATE TABLE" on your testcase schema): CREATE TABLE `Person_Address` ( `PersonID2` int(11) default NULL, `AddressID2` int(11) default NULL, KEY `FK_Person` (`PersonID2`), KEY `FK_Address` (`AddressID2`), CONSTRAINT `FK_Address` FOREIGN KEY (`AddressID2`) REFERENCES `Address` (`AddressID`), CONSTRAINT `FK_Person` FOREIGN KEY (`PersonID2`) REFERENCES `Person` (`PersonID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1 However, note that we don't consider this a bug per-se (from the manual at http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html): "RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as omitting the ON DELETE or ON UPDATE clause. (Some database systems have deferred checks, and NO ACTION is a deferred check. In MySQL, foreign key constraints are checked immediately, so NO ACTION and RESTRICT are the same.)"