SQLite Forum

CHECK violation during table definition ignored, normal or bug?
Login
> I suppose that, in some sort of ideal, imaginary world, a tool such as SQLite would be light-weight **AND** contain enough logic to recognize that a given default value will never satisfy the given check constraint.

It could, but it is not reasonable to do so for CREATE TABLE (since you might want to require the data to be specified explicitly when adding it); it would, however, make sense to do this check for ALTER TABLE ADD COLUMN (if the table is not empty); the documentation says "Future versions of SQLite might change to validate CHECK constraints as they are added." (Implementing this seem like it would not be too complicated, as long as the CHECK constraint refers only to the column being added and not other columns; it would just evaluate the given expression, and see if the result is true.)