delete it and commit it... rollback is 'undo' and if anything was differen't it wouldn't be a very good undo. assign the key yourself? on failure keep incrementing? if it's supposed to have been inserted and deleted... then rollback is not the correct solution.
On Tue, Nov 11, 2014 at 2:04 AM, Koen Van Exem <k...@allors.com> wrote: > --- 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 > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users