// sqlite · sql behavior

ignore_check_constraints

Temporarily stop enforcing CHECK constraints on this connection.

Default
0 (off)
Range
0, 1
Restart needed
No
Default checked on
SQLite 3.5x

What it does

Off by default, so CHECK constraints are enforced. Turning it on skips the CHECK clause on INSERT and UPDATE, while NOT NULL, UNIQUE and PRIMARY KEY rules still apply. The setting rides on the connection and is not persisted.

Default value

0 (off). Off (a stock SQLite 3.5x build), meaning CHECK constraints are enforced.

Check the current value

PRAGMA ignore_check_constraints;

SELECT * FROM pragma_ignore_check_constraints;   -- table-valued form, usable in queries

Change it

PRAGMA ignore_check_constraints = ON;   -- this connection only

No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.

When to change it

For staged data loads that must insert rows known to break a CHECK, then clean them up before real traffic reaches the table.

What can go wrong

Rows written while it is on stay invalid after it is off again, and nothing re-checks them automatically; follow every bulk load with a query that reruns the CHECK expressions and fixes or removes what fails.

Questions about ignore_check_constraints

What is the default value of ignore_check_constraints in SQLite?

0 (off). Off (a stock SQLite 3.5x build), meaning CHECK constraints are enforced.

Does changing ignore_check_constraints require a restart?

No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.

When should I change ignore_check_constraints?

For staged data loads that must insert rows known to break a CHECK, then clean them up before real traffic reaches the table.

Back to all SQLite settings, or check the SQLite manual for every option.

// one client for every engine

Check ignore_check_constraints on your own server

SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.

Text and data on this page: CC BY 4.0, credit SQLly (sqlly.app). Code and SQL snippets: MIT. License details View as Markdown