I have the following two tables in SQLite: Many Main rows may reference the same link id, and many Link rows may have the same link id, such that select * from Main natural join Link where main_id=1 will return N rows, and select * from Main where link_id=1 will return K rows. The link id is important, and the
Tag: referential-integrity
SET CONSTRAINTS ALL DEFERRED not working as expected
In a PostgreSQL 9.3 database, if I define tables a and b as follows: And then do the following: It produces the error below. Why is SET CONSTRAINTS not having the desired effect? Answer Only DEFERRABLE constraints can be deferred. Let me suggest superior alternatives first: 1. INSERT in order Reverse the sequence of the INSERT statements and nothing needs