Re: [sqlite] INSERT OR REPLACE and foreign keys

2018-10-23 Thread Olivier Mascia
> Le 23 oct. 2018 à 19:52, Roman Fleysher 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

Re: [sqlite] INSERT OR REPLACE and foreign keys

2018-10-23 Thread Shawn Wagner
That's normal. It deletes the conflicting row and inserts a new one. On Tue, Oct 23, 2018, 10:58 AM Roman Fleysher < roman.fleys...@einstein.yu.edu> wrote: > Dear SQLiters, > > I am using INSERT OR REPLACE to update a table which holds a column which > servers as a foreign key. But I noticed a

[sqlite] INSERT OR REPLACE and foreign keys

2018-10-23 Thread Roman Fleysher
Dear SQLiters, I am using INSERT OR REPLACE to update a table which holds a column which servers as a foreign key. But I noticed a strange behavior: If the parent record existed, then replace mechanism replaces it, but the records from children tables are deleted. The foreign key is set up to