SQLite User Forum

CHECK violation during table definition ignored, normal or bug?
Login
This was fixed sometime between whatever version of SQLite3 you are using and the current tip of trunk.

```
SQLite version 3.34.0 2020-08-24 16:05:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>
sqlite>
sqlite> create table t(
   ...>   id integer primary key,
   ...>   s text not null default 'abc' check(length(s) < 3) --no error (bug?)
   ...>   );
sqlite> insert into t(id) values(1); --expected error as default value violates CHECK
Error: CHECK constraint failed: t
sqlite>
```

So what old version of SQLite3 are you using?

Note that if what you claim were true, then data passing an INSERT would violate a subsequent integrity_check.  CHECK constraints are invarient so I suspect this was fixed at the same time as the "application of affinity before evaluating check constraints" was fixed several releases ago a this caused the same problem -- that the CHECK constraints were not properly invariant.