Thanks Ryan for your explanation. However, I do not really understand it. The reason why I posted this long schema is that I was unable to create a minimal example triggering the same error. For example: CREATE TABLE a (id INTEGER PRIMARY KEY UNIQUE NOT NULL); CREATE TABLE b (id INTEGER PRIMARY KEY UNIQUE NOT NULL, a_id REFERENCES a(id)); CREATE TABLE c (id INTEGER PRIMARY KEY UNIQUE NOT NULL, b_id REFERENCES b(id)); DROP TABLE a; DROP TABLE c; -- works fine despite missing reference in table "b"