/ Check-in [0755b9b6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modify the ".dump" command on the CLI so that it always issues a PRAGMA foreign_keys=OFF at the top of the output.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0755b9b697d32292f378a4b934ca1cf9f56225cd
User & Date: drh 2009-09-23 15:51:36
Context
2009-09-23
17:30
Do not check immediate foreign key constraints until the end of the statement. This matches the postgres behaviour. check-in: 1a32149c user: dan tags: trunk
15:51
Modify the ".dump" command on the CLI so that it always issues a PRAGMA foreign_keys=OFF at the top of the output. check-in: 0755b9b6 user: drh tags: trunk
14:45
Change the version number to 3.6.19. Fix a couple of incorrect testcase() macros associated with the new IS and IS NOT operators in expr.c. check-in: e3b73394 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  2089   2089         sqlite3_free(zErrMsg);
  2090   2090       }
  2091   2091     }else
  2092   2092   
  2093   2093     if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
  2094   2094       char *zErrMsg = 0;
  2095   2095       open_db(p);
         2096  +    /* When playing back a "dump", the content might appear in an order
         2097  +    ** which causes immediate foreign key constraints to be violated.
         2098  +    ** So disable foreign-key constraint enforcement to prevent problems. */
         2099  +    fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
  2096   2100       fprintf(p->out, "BEGIN TRANSACTION;\n");
  2097   2101       p->writableSchema = 0;
  2098   2102       sqlite3_exec(p->db, "PRAGMA writable_schema=ON", 0, 0, 0);
  2099   2103       if( nArg==1 ){
  2100   2104         run_schema_dump_query(p, 
  2101   2105           "SELECT name, type, sql FROM sqlite_master "
  2102   2106           "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'", 0