SQLite Forum

Foreign key trust error

Foreign key trust error

(1) By yuri (yurizaki26) on 2020-06-23 15:07:31 [source]

When I execute a project and send a record of a Forenkay where this key does not exist, the database is saving normally, already using the software "SQLiteStudio" it does not allow to be inserted.

When I try to save I would have to show an error.

I'm using android studio, with java.

(2) By Dan Kennedy (dan) on 2020-06-23 17:31:17 in reply to 1 [link] [source]

You might need to enable FK support using:

PRAGMA foreign_keys = ON;


You need to execute this PRAGMA immediately after opening each connection. Or from within the onConfigure() hook if using SQLiteOpenHelper.