| Previous | Next |
| SQLITE_E_TOOBIG | SQLITE_E_MISMATCH |
SQLITE_E_CONSTRAINT
SQLITE_E_CONSTRAINT corresponds to SQLite SQLITE_CONSTRAINT. A statement attempted to leave the database in a state that violates a declared rule such as CHECK, NOT NULL, UNIQUE, PRIMARY KEY, or FOREIGN KEY.
The base code does not identify the failed rule. Retrieve the extended result code and the complete SQLite error message, then inspect the statement values and the table definition.
What to check
- Log the SQL statement parameters or an equivalent safe representation of them; the schema alone is not enough to reproduce most constraint failures.
- Use
sqlite_masteror.schemato verify the actual table, index, and trigger definitions deployed on the affected machine. - Choose an explicit conflict strategy only when it matches the data model; do not use
OR REPLACEmerely to hide duplicate data.
SELECT sql FROM sqlite_master WHERE type IN ('table', 'index', 'trigger');
SQLite: Result and Error Codes
SQLite: Constraint Conflict Resolution
SQLite: CREATE TABLE and Constraints
Looking for a different code? Search another status or error code.