I have found that SQLite3’s auto incrementation is always one more than the highest existing primary key.
For instance I create a record and its id is set to 1. Then the next record’s id is set to 2. If I delete the record with id = 2 and create a new record, the new one’s id is set to 2, instead of 3.
Is their anyway to have the auto increment of sqlite3 never assign the same value twice?
The docs at http://www.sqlite.org/autoinc.html clearly state that the behavior you are seeing is expected. The docs also state that you avoid this issue by making the column: