On 2014/12/18 12:03, Dan Kennedy wrote:
On 12/18/2014 04:16 PM, Paul wrote:
I understand. I guess, I'll have to stick to UPDATE <-> INSERT.
Thank you for taking your time.

Just out of curiosity, I want to ask one more question.
How can FK constraint fail if I am removing (replacing) row from the 'child' 
table?

The FK constraint can fail because a new row is being inserted into the child table. The reason statement rollback may be required is because any replaced rows will be removed before SQLite has a chance to figure out if the INSERT actually does violate the PK constraint.


Also - I think it depends on more factors, like that may not be the only child table linking to that item in the parent, nor is the child table excluded from also being a parent to another table. Constraints may fail all over and knowing all this before-hand would require a much longer query prep I would imagine, but the journal does the job.

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

Reply via email to