On 2015-11-18 1:27 AM, Yuri wrote: > On 11/18/2015 01:17, Darren Duncan wrote: >> >> Deferred constraints are definitely a benefit. >> >> They allow you to express constraints otherwise not possible, for example >> that >> a record may exist in table X if and only if a counterpart exists in table Y, >> such as balancing records in a double-entry accounting system. Granted all >> you really need for this is the ability to change multiple tables as a single >> atomic operation, but failing that ability, deferred constraints are the way >> SQL provides to do it. > > I agree they can be beneficial, but not in all cases. Depends on what you do. > It > would have been great if it was an option, ex. "CONSTRAINT LEVEL > [STATEMENT|TRANSACTION];".
You can declare that behavior individually per foreign key constraint, and you can also change it at runtime with https://www.sqlite.org/pragma.html#pragma_defer_foreign_keys if that's what you were looking for. -- Darren Duncan