Looking at the docs for liquibase and add-foreign-key-constraint there is a property called deferrable. But the docs don't really mention what that property does. Anyone know?
DEFERRABLE
NOT DEFERRABLE
This controls whether the constraint can be deferred. A constraint that is not deferrable will be checked immediately after every command. Checking of constraints that are deferrable may be postponed until the end of the transaction (using the SET CONSTRAINTS command). NOT DEFERRABLE is the default. Only foreign key constraints currently accept this clause. All other constraint types are not deferrable.
[Source] http://www.postgresql.org/docs/8.1/static/sql-createtable.html
In short, assume two tables have cyclic FK dependency. When we perform insert data for which reference data is not present in both tables and FK constraint is not deferred, the DB would throw error since there is a violation of FK constraint. If deferred, the validation would be performed at the time of committing a transaction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With