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 default ''
);
create virtual table search using fts2(one_id, data);
create trigger sound_insert after insert on one for each row
begin
insert into search (one_id, data) values (new.id, new.value);
end;
create trigger one_update after update on one for each row
begin
update search set data = random() where search.one_id=new.id;
end;
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
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
My scheme is a bit more complex (more triggers and more tables), but
this is as far as I could reduce it.
Notice that if the search table gets updated via a trigger NOT
installed on the "one" table, the same problem occurs.
I found the problem described here:
http://www.mail-archive.com/[email protected]/msg30552.html
but there was no mention of a fix, nor was there a simple example
which reproduced the error.
Has this been fixed?
kindest,
- Bram
--
http://freesound.iua.upf.edu
http://www.smartelectronix.com
http://www.musicdsp.org
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users