On Fri, Jan 9, 2015 at 11:35 AM, Niall O'Reilly <niall.orei...@ucd.ie>
wrote:

> At Thu, 08 Jan 2015 15:55:00 -0700,
> Keith Medcalf wrote:
> >
> > when you load a dump file you need to have that foreign
> > key enforcement off in order to be able to load the database.  This
> > is because the tables and data are dumped in random order, not in
> > hierarchical order (parents of parents then their children then
> > their children and so on and so forth) or mayhaps there are
> > self-referential or referential loops which cannot be resolved
> > without turning off foreign key enforcement while loading the
> > database "in bulk" rather than by following the application business
> > logic processing to only add records the would meet referential
> > constraints.
>
>   Thanks for explaining. This makes sense.
>

Yet SQLite defers FK errors to commit time, so even loading in a random
order should work provided the load is within a single transaction, which
it most likely is.

So SQLite could well output PRAGMA foreign_keys=ON and still be able to
load the dump. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to