On 11/17/15, Yuri <yuri at rawbw.com> wrote:
>
> Don't keep the bag, keep only one integer ID of the first failed
> constraint.

Therein lays the rub: there is no way to tell which (if any) FK
constraint has failed until you have run the operation to the end and
checked them all.  Remember, an FK constraint is allowed to be
violated during a transaction, as long as the violation is resolved
before the end of the transaction.

With CHECK, and UNIQUE, and NOT NULL constraints, you do know that the
constraint has failed right away.  And for those constraints, SQLite
does provide more detail about exactly which constraint failed.  But
for FK constraints, you never know if a constraint that is failing
right now might be resolved before the end of the transaction.

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to