Bug #38585 Foreign key constraint for column in same table fails on delete when same row
| Submitted: | 5 Aug 2008 22:01 | Modified: | 16 Oct 2008 3:48 |
|---|---|---|---|
| Reporter: | Tim Faust | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 6.0.5 alpha | OS: | Windows (Vista) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | foreign key | ||
[5 Aug 2008 22:01]
Tim Faust
[6 Aug 2008 3:15]
Valeriy Kravchuk
This is a documented limitation. Read http://dev.mysql.com/doc/refman/6.0/en/innodb-foreign-key-constraints.html: "Deviation from SQL standards: Like MySQL in general, in an SQL statement that inserts, deletes, or updates many rows, InnoDB checks UNIQUE and FOREIGN KEY constraints row-by-row. According to the SQL standard, the default behavior should be deferred checking. That is, constraints are only checked after the entire SQL statement has been processed. Until InnoDB implements deferred constraint checking, some things will be impossible, such as deleting a record that refers to itself via a foreign key."
[6 Aug 2008 16:02]
Tim Faust
Thansk, I missed that in the documentation. I'll implement my work around. Feel free to close if you prefer that to "To be fixed later"
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.