> Le 23 oct. 2018 à 19:52, Roman Fleysher <roman.fleys...@einstein.yu.edu> a 
> écrit :
> 
> I am using INSERT OR REPLACE ... it seems that "replace" is implemented as 
> "delete then insert" rather than "update". Is that normal and expected? Am I 
> doing something wrong?

Normal and expected.  Check https://www.sqlite.org/lang_insert.html. The OR 
REPLACE is a kind of exception handling mechanism.

What you are looking for is the upsert clause for your insert statement: 
https://www.sqlite.org/syntax/upsert-clause.html.

Some other engines might have an INSERT OR UPDATE (not REPLACE) and you have 
lead to think the OR REPLACE implemented by SQLite is that feature. It is not. 
The more general ON CONFLICT ... DO ... is what you're after.


-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia


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

Reply via email to