On 8 Jan 2015, at 1:38pm, Niall O'Reilly <niall.orei...@ucd.ie> wrote:

>  I'ld have expected the foreign_keys pragma setting to have been
>  preserved.

That makes sense in terms of how a sensible user would expect SQLite to behave. 
 But unfortunately it's not what SQLite does.  See section 2 of

<https://www.sqlite.org/foreignkeys.html>

I think that the reason is that FOREIGN KEYs were developed a long time after 
SQLite3.  A choice was made that they should default to OFF to preserve 
backward compatibility.

So yes, as your experiment shows, you have to execute

PRAGMA foreign_keys = ON

each time you open a database connection if you want the foreign keys to do 
their stuff.

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

Reply via email to