NO ACTION will also raise an error if the referenced value does not exist, but it can be deferred, giving you slightly more freedom when deleting data. In the previous section about referential actions, I said that we’d cover the difference between NO ACTION and RESTRICT in more detail: RESTRICT is the toughest measure to prevent referenced rows from being dropped as the check cannot be deferred. SET CONSTRAINTS ALL DEFERRED SET CONSTRAINTS "post_author_fkey" DEFERRED □īut there’s a catch: Deferring constraints only works when the foreign key constraints have been marked as deferrable. ![]() You declare these actions when adding the constraint
0 Comments
Leave a Reply. |