Bug #75620 | Foreign key allows insert or update on child table but gets Error 1451 on parent | ||
---|---|---|---|
Submitted: | 24 Jan 2015 15:42 | Modified: | 26 Jan 2015 14:16 |
Reporter: | Robert Simpson | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB Plugin storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6.22 | OS: | Linux (CentOS 7) |
Assigned to: | CPU Architecture: | Any | |
Tags: | foreign key update error 1451 case sensitive |
[24 Jan 2015 15:42]
Robert Simpson
[24 Jan 2015 15:54]
Robert Simpson
In a slightly longer test case, if the child row is originally inserted with the value in all lower case, it cam be updated to mixed case successfully but then the parent update fails in the same manner.
[26 Jan 2015 14:16]
MySQL Verification Team
This has nothing to do with Foreign Key constraint being case sensitive or case insensitive. Actually, this is a behavior that follows SQL standard and has the same result whenever a change is attempted on the tuple in the parent table, which is referenced by any tuple in the child table. Our manual, actually, explains it quite clearly: " The MySQL Server rejects the delete or update operation for the parent table if there is a related foreign key value in the referenced table. Some database systems have deferred checks, and NO ACTION is a deferred check. In MySQL, foreign key constraints are checked immediately, so NO ACTION is the same as RESTRICT. "