On Mon, May 9, 2016 at 3:46 PM, Dominique Devienne <ddevienne at gmail.com> wrote: > On Mon, May 9, 2016 at 3:21 PM, Cecil Westerhof <cldwesterhof at gmail.com> > wrote: >> I made a table with a few CHECK constraints. When an INSERT is not >> possible, I would like to know which CHECK constraint fired. Is there a way >> to get this information? > > Just names your CHECK constraint, and use a recent version of SQLite. --DD
C:\Users\ddevienne>sqlite3 SQLite version 3.10.2 2016-01-20 15:27:19 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> create table t (v constraint is_bool check (v in (0, 1))); sqlite> insert into t values (1); sqlite> insert into t values (0); sqlite> insert into t values (2); Error: CHECK constraint failed: is_bool sqlite>