Folks, I've been using SQLite for many months now and as I previously said,
it plays nicely with EF4. However I just found out by accident that SQLite
does not enforce foreign key constraints. I didn't realise until I performed
a bulk load of my database with thousands of incorrect PK and FK values and
it just swallowed the lot and loaded all the garbage I threw at it.

 

Then I had a look and found this: SQLite Foreign Key Support
<http://www.sqlite.org/foreignkeys.html>  (see down in item 2). It says that
to enable constraints you have to compile it with a certain definition and
then set a PRAGMA at runtime. Yeah great! I'm not wasting time compiling the
whole damn raw source code and then trying to figure out how to set a PRAGMA
in managed code at runtime (unless someone already knows how to do this
easily).

 

The reason I didn't discover this issue for 6 months is because I never
looked. And why didn't I look? ... I could never have imagined that anyone
in their right mind could create a relation database that does not enforce
FK constraints, but they did. They warn on the web page that they may
reverse the behaviour in the future and enable FK constraints by default.

 

I will continue using SQLite because I love the zero installation footprint
and in all other respects it seems to be working very well. However, just be
aware of the really slack FK behaviour.

 

Greg

Reply via email to