On Wed, Nov 14, 2012 at 6:01 PM, Simon Slavin <slav...@bigfraud.org> wrote: > It's also worth knowing about > > UPDATE OR REPLACE > > which is similarly not MERGE, but has more MERGE-like behaviour. Though what > it does I had to figure out myself since the documentation on the 'UPDATE' > page doesn't describe it.
>From what I've seen UPDATE OR REPLACE will *delete* existing records if a PK or unique constraint is violated: insert into master values (1, '1'); insert into master values (2, '2'); insert into detail values (1, 1, '1'); insert into detail values (2, 2, '2'); update or replace master set id = 1, descr = 'a' where id = 2 select * from master; 1 'a' select * from detail; 2 1 '2' In this case detail record 1 - 1 - '1' seems to have been cascade-deleted and 2 - 2 - '2' cascade-updated. Still nothing to do with MERGE behaviour IMHO. There doesn't seem to be a way to perform "UPSERT"s in SQLite. An UPSERT modifies an existing record or inserts one if a matching one is not found. It never deletes one. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users