SQLite Forum

Error when trying to add a column (Error checking foreign keys after table modification)
Login

Error when trying to add a column (Error checking foreign keys after table modification)

(1) By zappfinger on 2021-03-25 12:41:23 [source]

I am using DB Browser for SQLite (on Linux Mint). When I try to add a column to an existing table (via Modify table/Add field) I get "Error checking foreign keys after table modification. The changes will be reverted" When I add the column via the sqlite3 command prompt there is no problem

(2) By Donald Griggs (dfgriggs) on 2021-03-25 13:15:00 in reply to 1 [link] [source]

Hello, Zappfinger,

The db browser software isn't written or maintained by the sqlite team, so you'd want to find the maintainers of that software and give them a detailed minimal reproducible example.

(3) By Ryan Smith (cuz) on 2021-03-25 14:03:07 in reply to 1 [link] [source]

To add to what Donal said, note that SQLite3 will happily create a Schema that contains unresolved foreign keys, and also that it may start with foreign-key checking turned OFF (depending on how it was compiled).

I am not involved with DB Browser itself, but as a maintainer of another SQLite admin software, my guess is that:

  • DB Browser is starting up and switching foreign key checking on immediately for you,

  • It also checks the foreign keys and schema accuracy after changes for you and does you the favor of failing when the change breaks it.

These are pure guesses, you need to ask the DB Browser people, but I'm mentioning it since I doubt that it is a bug - probably works as intended.

(4) By anonymous on 2023-03-31 15:22:59 in reply to 1 [link] [source]

For anyone else finding this... Switch off "Foreign keys" and switch on "Ignore Check Constraints" in the Pragma panel while making changes. But make sure that any changes don't break and foreign keys or constraints.

Steve V