/ Check-in [211d5dde]
Login

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 Unified Diffs Show Whitespace Changes Patch

Changes to src/build.c.

403
404
405
406
407
408
409







410
411
412
413
414
415
416

  if( iDb>=0 ){
    /* Case 1:  Reset the single schema identified by iDb */
    Db *pDb = &db->aDb[iDb];
    if( pDb->pSchema ){
      assert(iDb==1 || (pDb->pBt && sqlite3BtreeHoldsMutex(pDb->pBt)));
      sqlite3SchemaFree(pDb->pSchema);







    }
    return;
  }
  /* Case 2 (from here to the end): Reset all schemas for all attached
  ** databases. */
  assert( iDb<0 );
  sqlite3BtreeEnterAll(db);







>
>
>
>
>
>
>







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423

  if( iDb>=0 ){
    /* Case 1:  Reset the single schema identified by iDb */
    Db *pDb = &db->aDb[iDb];
    if( pDb->pSchema ){
      assert(iDb==1 || (pDb->pBt && sqlite3BtreeHoldsMutex(pDb->pBt)));
      sqlite3SchemaFree(pDb->pSchema);
    }
    /* If any database other than TEMP is reset, then also reset TEMP
    ** since TEMP might be holding triggers that reference tables in the
    ** other database.
    */
    if( iDb!=1 && (pDb = &db->aDb[1])!=0 && pDb->pSchema ){
      sqlite3SchemaFree(pDb->pSchema);
    }
    return;
  }
  /* Case 2 (from here to the end): Reset all schemas for all attached
  ** databases. */
  assert( iDb<0 );
  sqlite3BtreeEnterAll(db);