On 28 Mar 2014, at 12:23pm, Kees Nuyt <k.n...@zonnet.nl> wrote:

> The next ID will usually be 11, but it is not guaranteed.
> One day, it could suddenly be 5.

Just to add more to that, the rule is currently along the lines of

"New IDs will continue to increment until SQLite runs out of integers, at which 
point SQLite will reuse numbers from deleted rows."

But this is not a documented specification for SQLite.  It is allowed to use 
any integer which is currently unused.  I have no idea whether it's allowed to 
use negative integers.

However, you are not expected to depend on any of the above for any place where 
SQLite makes up a row number for you.  You're meant to use the documented ways 
to find which ID SQLite assigned to your new row:

<https://sqlite.org/c3ref/last_insert_rowid.html>
<https://sqlite.org/lang_corefunc.html#last_insert_rowid>

Usual warnings about multi-threaded programs, TRIGGERs and FOREIGN KEYs.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to