/ Check-in [211d5dde]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:When resetting any non-TEMP schema, also reset the TEMP schema since it might be holding references to the non-TEMP schema that just got reset.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema-parse-refactor
Files: files | file ages | folders
SHA1: 211d5dde1f9c15048c65d1d700141aa7b2491011
User & Date: drh 2011-04-02 16:50:25
Context
2011-04-02
20:08
Merge in the latest changes from trunk. check-in: 0d99229a user: drh tags: schema-parse-refactor
16:50
When resetting any non-TEMP schema, also reset the TEMP schema since it might be holding references to the non-TEMP schema that just got reset. check-in: 211d5dde user: drh tags: schema-parse-refactor
16:28
Begin a series of changes designed to reduce the scope and frequency of invalidating schemas. Design goals are that the internal schema should never be deleted out from under a prepared statement that is running and that all prepared statements should be expired if the schema is invalidated. At the same time, minimize the number of schema invalidations. This change merely revises the sqlite3ResetInternalSchema() function to use -1 as the wildcard for "all" rather than 0, so that we can reset the main schema independently of all the others. check-in: 6a8ad6e3 user: drh tags: schema-parse-refactor
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

   403    403   
   404    404     if( iDb>=0 ){
   405    405       /* Case 1:  Reset the single schema identified by iDb */
   406    406       Db *pDb = &db->aDb[iDb];
   407    407       if( pDb->pSchema ){
   408    408         assert(iDb==1 || (pDb->pBt && sqlite3BtreeHoldsMutex(pDb->pBt)));
   409    409         sqlite3SchemaFree(pDb->pSchema);
          410  +    }
          411  +    /* If any database other than TEMP is reset, then also reset TEMP
          412  +    ** since TEMP might be holding triggers that reference tables in the
          413  +    ** other database.
          414  +    */
          415  +    if( iDb!=1 && (pDb = &db->aDb[1])!=0 && pDb->pSchema ){
          416  +      sqlite3SchemaFree(pDb->pSchema);
   410    417       }
   411    418       return;
   412    419     }
   413    420     /* Case 2 (from here to the end): Reset all schemas for all attached
   414    421     ** databases. */
   415    422     assert( iDb<0 );
   416    423     sqlite3BtreeEnterAll(db);