SQLite Forum

Bug?: CREATE TABLE with unsatisfied FK and DROP TABLE results in Error
Login
Hi,

we have noticed this bug during a create & purge of a much larger data model. I narrowed it down to the essential lines.

```
CREATE TABLE "column" (
  "id"              INTEGER PRIMARY KEY AUTOINCREMENT,

  "other_table_id"  INTEGER,
  "other_column_id" INTEGER,

  FOREIGN KEY (other_table_id) REFERENCES "table" (id) ON DELETE CASCADE ON UPDATE CASCADE,
  FOREIGN KEY (other_column_id) REFERENCES "column" (id) ON DELETE CASCADE ON UPDATE CASCADE
);

DROP TABLE "column";
```

**Error: near line 12: no such table: main.table**

Removal of any column in the table fixes the Error.


```
➜  sqlite-tools-osx-x86-3310100 git:(develop) ✗ ./sqlite3 --version                                                               
-- Loading resources from /Users/martin/.sqliterc
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6
```