sqlite-diffable icon indicating copy to clipboard operation
sqlite-diffable copied to clipboard

Restoring dumps which contain AUTOINCREMENT columns

Open Timmeey86 opened this issue 2 years ago • 0 comments

Hi, great tool, this is exactly what I'm looking for.

I do however have an issue when using AUTOINCREMENT columns.

If you create a table like this

CREATE TABLE IF NOT EXISTS DummyTable (
    DummyTableId INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
);

and insert a row into that table

INSERT INTO DummyTable VALUES(NULL);

the exported dump will contain both the .metadata.json and the .json file of the sqlite_sequence table.

When trying to import that, the import into a new file fails with:

Error: object name reserved for internal use: sqlite_sequence

Importing into an existing file will fail when trying to drop that table.

Updating the table seems to work though, so programming a special case for this to just insert/update any values might work

Timmeey86 avatar Mar 09 '23 16:03 Timmeey86