Ticket Hash: | b1d3a2e531478b4e069df3d2e847b8d4346ce4ce | ||
Title: | Erroneous FK constraint failure when dropping table. | ||
Status: | Closed | Type: | Code_Defect |
Severity: | Minor | Priority: | Immediate |
Subsystem: | Code_Generator | Resolution: | Fixed |
Last Modified: |
2011-08-22 17:49:43 13.87 years ago |
Created: |
2011-08-22 09:37:52 13.87 years ago |
Version Found In: | 3.7.7.1 |
Description: | ||||
The following script causes a constraint failure.
CREATE TABLE pp(x PRIMARY KEY); CREATE TABLE cc(y REFERENCES pp DEFERRABLE INITIALLY DEFERRED); INSERT INTO pp VALUES('a value'); INSERT INTO cc VALUES('a value'); BEGIN; DROP TABLE pp; DROP TABLE cc; COMMIT; The problem is that SQLite sees that the "DROP TABLE pp" creates a constraint violation (since there is now an orphan row in "cc"). However it does not see that "DROP TABLE cc" corrects the violation (by deleting the orphan). This is an oversight in the implementation of foreign-keys. The bug has been present ever since FK support was introduced, in version 3.6.19. dan added on 2011-08-22 09:55:58: |