I have set PRAGMA foreign_keys=ON;
I'm trying to delete some records in a sqlite3 table and it displays Error: constraint failed
sqlite> delete from auth_user where id = 110;
Error: constraint failed
It works if the PRAGMA foreign_keys
was OFF. The database has so many tables and the error is so vague. I think other database systems will list the tables that reference the primary key if we attempt deletion.
What is the efficient way I can find all the tables that reference that particular primary key id=110?
Schema:
CREATE TABLE "auth_user" (
"id" integer NOT NULL PRIMARY KEY,
"username" varchar(30) NOT NULL UNIQUE,
"first_name" varchar(30) NOT NULL,
"last_name" varchar(30) NOT NULL,
"email" varchar(75) NOT NULL,
"password" varchar(128) NOT NULL,
"is_staff" bool NOT NULL,
"is_active" bool NOT NULL,
"is_superuser" bool NOT NULL,
"last_login" datetime NOT NULL,
"date_joined" datetime NOT NULL
);