--- Begin --- sqlite> drop table if exists demo; sqlite> create table demo (id integer primary key autoincrement, value text); sqlite> begin transaction; sqlite> insert into demo (value) VALUES ('value'); sqlite> select last_insert_rowid(); 1 sqlite> delete from demo where id = 1; sqlite> rollback; sqlite> begin transaction; sqlite> insert into demo (value) VALUES ('value'); sqlite> select last_insert_rowid(); 1
--- End --- Using a delete statement before the rollback doesn't help. I really want sqlite to only issue an id once. Is this possible? Thanks, Koen 2014-11-11 10:35 GMT+01:00 Clemens Ladisch <clem...@ladisch.de>: > Koen Van Exem wrote: > > Is it a bug or feature that the autoincrement > > value is being reused when a rollback is issued? > > > > The documentation on https://www.sqlite.org/autoinc.html is a bit > unclear > > > > ... it says it prevents reuse of ROWIDs from previously deleted rows. > > Only a DELETE statement results in "deleted rows". When an INSERT is > rolled back, the database is in a state as if the INSERT never happened. > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Koen Van Exem +32 3301 3301 +32 498 519999 k...@allors.com http://www.allors.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users