Bug #13977 | InnoDB foreign keys with multiple parent rows act incorrectly | ||
---|---|---|---|
Submitted: | 12 Oct 2005 20:00 | Modified: | 13 May 2010 16:04 |
Reporter: | Ian Gulliver | Email Updates: | |
Status: | Open | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S4 (Feature request) |
Version: | 5.0.13 | OS: | Linux (Debian Sarge) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[12 Oct 2005 20:00]
Ian Gulliver
[12 Sep 2006 1:16]
Peter Thomassen
I'm currently having the same problem, using CASCADE. I've written an invoicing application that handles invoices and reminders the same way, only differing in their level (invoice = 0, first reminder = 1, second = 2). In two cases, I accidentally created a reminder that I deleted afterwards. To my very surprise, the invoice items referencing the invoice number were gone because the reminder row was another parent row with the same number. I was angry and looked for my backup. The behavior I intended is that invoice items are only to be deleted when all reminders and invoices are deleted, i.e. when there isn't another parent row. Especially if the current behavior deviates from SQL, this should be fixed (and would, sometimes, simplify life a lot). Thank you.
[15 Feb 2009 18:59]
Peter Gulutzan
For WL#149 (Foreign keys all storage engines) the decision was: allowing multiple parent rows will be illegal if one starts the server with --foreign-key-all-engines=1.