Sqlite foreign key clauses2/11/2024 │ hall_id │ name │ phone │ address │ rent │ size │ manager_id │ Runtime error: FOREIGN KEY constraint failed (19) Sqlite> delete from manager where manager_id=99 Sqlite> insert into hall values(2, 'Monty Hall', '', '', '', 'big', 99) Sqlite> insert into manager values(99, 'Clark Kent', '', '') Sqlite> pragma foreign_keys - confirm current state. Insert into manager values(99, 'Clark Kent', '', '') Pragma foreign_keys - confirm current state. As expected, my attempt to delete a manager with an assigned hall failed.Īre you certain that foreign keys are enabled and that a manager was inappropriately deleted? OP, don't know this helps or not, but I pasted your schema into the CLI (in my case, into sqlite3.exe on Windows, version 3.39.2) followed by the trivial test below. My problem is that despite the foreign keys this seems to delete a manager even if he is still assigned to a hall. ![]() $q = "DELETE FROM manager where manager_id = ?" To explain my predicament, I have the following schema BEGIN TRANSACTION įOREIGN KEY("hall_id") REFERENCES "hall"("hall_id"),įOREIGN KEY("client_id") REFERENCES "client"("client_id")įOREIGN KEY("manager_id") REFERENCES "manager"("manager_id")
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |