Not really.  Normal increment of the rowid increments by 1:

sqlite> create table x(x);
sqlite> insert into x (rowid, x) values (-1000000, 1);
sqlite> insert into x values (2);
sqlite> insert into x values (3);
sqlite> insert into x values (4);
sqlite> select rowid, x from x;
-1000000|1
-999999|2
-999998|3
-999997|4

AUTOINCREMENT will make the value "greater than the largest value that has ever 
been in the table" and will indeed make sure that autoincremented rowid's are 
greater than 0, however, it does not prevent a rowid with a value less than 0.

sqlite> create table y(rowid integer primary key autoincrement, x);
sqlite> insert into y (rowid, x) values (-1000000, 1);
sqlite> insert into y (x) values (2);
sqlite> insert into y (x) values (3);
sqlite> insert into y (x) values (4);
sqlite> delete from y where x=4;
sqlite> insert into y (x) values (5);
sqlite> select * from y;
-1000000|1
1|2
2|3
4|5
sqlite>


> On 20 Sep 2015, at 11:59pm, Keith Medcalf <kmedcalf at dessus.com> wrote:
> 
> > The RowID is an integer.  It is perfectly possible to have RowID's with
> a value less than 0.
> >
> > sqlite> create table x(x);
> > sqlite> insert into x (rowid, x) values (-1, -1);
> > sqlite> select rowid, x from x;
> > -1|-1
> 
> Yep.  But it's unlikely in a world where you allow it to be set by
> autoincrement.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



Reply via email to