Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-22 Thread Dennis Cote
D. Richard Hipp wrote: > > I think the FTS virtual table is doing the INSERTs inside its xCommit > method, after the trigger has been exited. So the mechanism that > resets the last_insert_rowid when a trigger exits does not apply since > the trigger has already existed by the time the FTS

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-22 Thread D. Richard Hipp
On May 22, 2008, at 3:10 PM, Dennis Cote wrote: > Bram de Jong wrote: >> >> I have found a bug which happens in both FTS2 and FTS3. >> >> The bug happens when a trigger updates an FTS table: the insert ID >> gets trashed: >> > I think both Richard and Scott may have misread this one a little bi

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-22 Thread Dennis Cote
Bram de Jong wrote: > > I have found a bug which happens in both FTS2 and FTS3. > > The bug happens when a trigger updates an FTS table: the insert ID gets > trashed: > > <<< > create table one > ( > id integer not null primary key autoincreme

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-20 Thread Scott Hess
Bram, I don't think there is a solid workaround of the form you suggest. The last_insert_rowid() you're getting is for the segment in the internal segdir table, and is unrelated to the rowid of the overall virtual table. What you should be able to do is to call last_insert_rowid() IMMEDIATELY aft

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-20 Thread Scott Hess
On Tue, May 20, 2008 at 1:26 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > In Bram's case, he was surprised that the last-insert-rowid changed > because he is not thinking about how FTS works behind the scenes. And > this is reasonable. There is a lot of magic in FTS that programmers > are not

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-20 Thread Bram de Jong
Hello, On Tue, May 20, 2008 at 10:26 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > So it is not at all clear to me whether this behavior is a bug or a > feature. SQLite is doing what the documentation says it ought to do. > The question is, should the specification of what SQLite ought to do >

Re: [sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-20 Thread D. Richard Hipp
On May 20, 2008, at 1:21 PM, Bram de Jong wrote: > Hello all, > > > I have found a bug which happens in both FTS2 and FTS3. > > The bug happens when a trigger updates an FTS table: the insert ID > gets trashed: > > <<< > create table one > ( >

[sqlite] last_insert_rowid reproducible bug with triggers and FTS2 and 3

2008-05-20 Thread Bram de Jong
Hello all, I have found a bug which happens in both FTS2 and FTS3. The bug happens when a trigger updates an FTS table: the insert ID gets trashed: <<< create table one ( id integer not null primary key autoincrement, value text not null d