On Tue, 17 Nov 2015 22:29:10 -0500
Richard Hipp <drh at sqlite.org> wrote:
> 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.
As a matter of fact, violation of UNIQUE & PK constraints is enforced
rather too strictly in SQLite. Any UPDATE statement that modifie more
than one row of a UNIQUE column can fail because two rows may
*transiently* have the same value. SQLite will fail the statement
even though the completed transactation leaves the constraint
unviolated.
sqlite> create table T(t int not null primary key);
sqlite> insert into T values (1), (2);
sqlite> update T set t = t+1;
Error: UNIQUE constraint failed: T.t
--jkl