Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
pharmakom
· 4y ago · 0 comments
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?
Comments
[–]
ashkulz
4y ago
You can use DEFERRABLE INITIALLY DEFERRED constraints so that the check happens when the transaction is committed.
[–]
GoblinSlayer
4y ago
I assume the target is externally generated too, thus can be legitimately absent.
[–]
Cthulhu_
4y ago
I had this when importing test data; I found it acceptable (since it was just in development) to temporarily turn off FK checking.