On 5/12/15, Peter Haworth <pete at lcsql.com> wrote: > Couple of questions regarding the above command. > > Why does the above command include a PRAGMA foreign_keys=OFF command?
So that the script generator does not have to carefully arrange the order of the INSERT statements to avoid a foreign key constraint error. > > Wouldn't it make more sense for the CREATE commands to include IF NOT > EXISTS? > No. The script is suppose to recreate a database from scratch. The tables should not already exist. If they do, then something is wrong, and an error is appropriate. -- D. Richard Hipp drh at sqlite.org