SQLite Forum

Please explain the error on insert
Login
The items that refer to teacher 0 and student 0 are already in their respective tables. I put the there with pragma foreign_keys=0.

The insert that is failing has an unused student_id (4) and refers to an existing student_id (3):

```
INSERT INTO studenttable (student_id,student_displayname,teacher_id,student_prev,student_select)
   VALUES(4,'Doug',3,3,0);
```

What you are suggesting is that some mechanism is looking at existing rows to see if they are violating referential integrity (which they obviously do). And the checking occurs when I try to insert a new row.

If so, what is that mechanism?

Is there a table design which gets around the mechanism and still provides referential integrity for new inserts?