> No. INSERT OR REPLACE does an INSERT, possibly after doing a DELETE. It > never does an UPDATE.
http://www.sqlite.org/lang_conflict.html Similarly any detail rows that are linked with foreign keys to the affected row will be handled according to the FK's ON DELETE clause. For instance if the FK is ON DELETE CASCADE detail records will be deleted even if the affected row's key's value is not changed by the INSERT or REPLACE statement. create table master (id int primary key, descr text); create table detail (id int, parentid int, descr text, foreign key (parentid) references master on delete cascade); insert into master values (1, '1'); insert into detail values (1, 1, '1'); insert or replace into master values (1, '2'); select * from detail; > 0 records I mention this because it was a cause of grief for me, not having paid proper attention to the behaviour of INSERT OR REPLACE. PS: Because of this the INSERT OR REPLACE statement cannot be considered logically equivalent to MSSQL or ORACLE's MERGE statement (http://en.wikipedia.org/wiki/Merge_%28SQL%29) which IMHO should be added to SQLite at some point. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

