On 04.04.2011, at 15:59, Simon Slavin wrote:

> 
> On 4 Apr 2011, at 2:48pm, Enrico Thierbach wrote:
> 
>> isn't last_insert_rowid defined as the ID of the last row inserted
> 
> Yes it is.  But the FTS system does what it does by maintaining extra tables, 
> and doing extra operations to them besides the ones that the programmer has 
> asked for.  Naturally this means that several things get done after each 
> INSERT operation the programmer asked for, so last_insert_rowid() may as well 
> be a random number.
> 

I might have an exceptionally dumb day, but this sequence (from this post 
http://www.mail-archive.com/sqlite-users@sqlite.org/msg34082.html ) looks 
totally fine:
> insert into one (value) values ("hello1");
> select last_insert_rowid();   -- returns 1
> insert into one (value) values ("hello2");
> select last_insert_rowid(); -- returns 2
> update one set value="hello3" where id=1;
> select last_insert_rowid(); -- returns 3, but should return 2
until the update (assuming that the IDs reported are right, of course). The 
last one would be a problem, as last_insert_rowid() gets undefined in my 
understanding by the UPDATE anyways. Or do I miss a point?

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

Reply via email to