While checking something else I came across this.

SQLite version 3.16.0 2016-11-04 19:09:39
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> PRAGMA foreign_keys = ON;
sqlite> PRAGMA foreign_keys;
1
sqlite> CREATE TABLE artist(
   ...>   artistid    INTEGER PRIMARY KEY, 
   ...>   artistname  TEXT
   ...> );
sqlite> CREATE TABLE track(
   ...>   trackid     INTEGER, 
   ...>   trackname   TEXT, 
   ...>   trackartist INTEGER,
   ...>   FOREIGN KEY(trackartist) REFERENCES artist(artistid) ON UPDATE CASCADE
   ...> );
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE artist(
  artistid    INTEGER PRIMARY KEY, 
  artistname  TEXT
);
CREATE TABLE track(
  trackid     INTEGER, 
  trackname   TEXT, 
  trackartist INTEGER,
  FOREIGN KEY(trackartist) REFERENCES artist(artistid) ON UPDATE CASCADE
);
COMMIT;
sqlite> PRAGMA foreign_keys;
1

I have "PRAGMA foreign_keys = ON" when I do the .dump.  The ".dump" output 
turns the setting off so it can reconstruct the data without having to follow 
referential order.  But it doesn’t turn the setting back on again, even though 
(A) I have it turned on when I execute the ".dump" command and (B) the schema 
dumped uses foreign keys.

Would it be possible to have the ".dump" output end in a command to turn the 
setting back on again if it was on when the ".dump" command was used ?  I’m 
asking only because the output does explicitly turn that setting off.  I’m 
aware that that setting is not stored in the database file.

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

Reply via email to