Skip to content

Inserting pre-defined serial type gets overwritten #895

@shivavelingker

Description

@shivavelingker

I have a table that has an ID key set to be a serial datatype. When I insert data, this works as expected, setting the ID to the auto-incremented counter.

However, I occasionally is flush the entire database and inserting new data objects with their own ID keys. AlaSQL overwrites these keys with its own counter, which means if an object has ID = 4 but keys 1-3 have been deleted from the data set, it will be reassigned to 1.

Is this expected behavior? Is there a way to accomplish what I'm looking for? I have a back-end storage file which can be accessed from multiple devices, so for each instance of the app, I flush the localStorage database and reinsert the new data. I could theoretically just update already-existing data and insert the new data (i.e., data created on a different device that is being loaded onto this instance for the first time), but if the ID is overwritten, my app won't work.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions