PRAGMA

A SQLite statement that reads or changes a setting of the database library or of the current connection.

In more detail

PRAGMA foreign_keys = ON turns on foreign key enforcement, which SQLite leaves off by default for backward compatibility. The setting belongs to the connection, not the file, so every connection your application opens must set it. Only SQLite has it; PostgreSQL has no equivalent because it always enforces foreign keys.

Example

PRAGMA foreign_keys = ON;

Related terms

Taught in

References