Abi
Abi

Reputation: 4808

Foreign Key support in sqlite 3

I wanted to use foreign key mechanism for database. But, the tables are not following the integrity constraints. How can I be sure that, my sqlite3 db has Foreign key support ?

Upvotes: 5

Views: 285

Answers (1)

aTJ
aTJ

Reputation: 3913

Type the command "PRAGMA foreign_keys" in the sqlite3 prompt and if returns no data instead of a single row containing "0" or "1", then the version of SQLite you are using does not support foreign keys (either because it is older than 3.6.19 or because it was compiled with SQLITE_OMIT_FOREIGN_KEY or SQLITE_OMIT_TRIGGER defined)

More info is available in the link below: http://www.sqlite.org/foreignkeys.html

Upvotes: 8

Related Questions