Y
Hacker News
new
|
ask
|
show
|
jobs
by
pharmakom
1387 days ago
How about when the ID in a FK column has been generated outside the RDBMS but the target of the ID has not been written yet?
3 comments
ashkulz
1387 days ago
You can use DEFERRABLE INITIALLY DEFERRED constraints so that the check happens when the transaction is committed.
link
GoblinSlayer
1387 days ago
I assume the target is externally generated too, thus can be legitimately absent.
link
Cthulhu_
1387 days ago
I had this when importing test data; I found it acceptable (since it was just in development) to temporarily turn off FK checking.
link