Apparently, the update is done a row at a time. Whether a row is deleted depends on whether the row being updated clashes with a current row when adding one.
Sometimes it will, sometimes it won't. 1, 2, 3 If the rows are updated (3, 2, 1) it all works. 3 -> 4 2 -> 3 1 -> 2 If the rows are updated (1, 2, 3) one row gets deleted. 1 -> 2 2 -> (deleted) 3 -> 4 Marc > -----Original Message----- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Petite Abeille > Sent: Monday, May 07, 2012 9:06 AM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] Bug: Increment unique integer field > > > On May 7, 2012, at 2:48 PM, Igor Tandetnik wrote: > > > begin; > > update numbers set num = -num; > > update numbers set num = -num + 1; > > end; > > Right... now... out of curiosity... what happen when you do the following: > > update or replace numbers set num=num+1; > > Note the 'or replace'. Did that 'update or replace' just managed to > delete a row or two?!??!? > > Bug or feature? > _______________________________________________ > 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