SQLite

Check-in [1194a42add]
Login

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

Overview
Comment:Fix the assert_schema_state_ok() routine so that it correctly ignores ATTACH-ed database that failed to open due to an error.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | reuse-schema
Files: files | file ages | folders
SHA3-256: 1194a42add4119715347bb592feef352e4958d0c669c946d976a42049a712b68
User & Date: drh 2020-01-15 17:18:34.986
Context
2020-01-18
18:59
Have this branch call sqlite3LockAndPrepare() instead of sqlite3Prepare() when parsing SQL for new schema objects in order to ensure that schemas are released as soon as possible. (check-in: 7a4ec57985 user: dan tags: reuse-schema)
2020-01-15
17:18
Fix the assert_schema_state_ok() routine so that it correctly ignores ATTACH-ed database that failed to open due to an error. (check-in: 1194a42add user: drh tags: reuse-schema)
14:26
Merge all recent enhancements and fixes from trunk. (check-in: f783917800 user: drh tags: reuse-schema)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/callback.c.
45
46
47
48
49
50
51

52
53
54
55
56
57
58
59
static void assert_schema_state_ok(sqlite3 *db){
  if( IsSharedSchema(db) && db->magic!=SQLITE_MAGIC_ZOMBIE ){
    int i;
    for(i=0; i<db->nDb; i++){
      if( i!=1 ){
        Db *pDb = &db->aDb[i];
        Btree *pBt = pDb->pBt;

        assert( pBt==0 || sqlite3BtreeSchema(pBt, 0, 0)==0 );
        assert( pDb->pSchema );
        if( pDb->pSPool ){
          if( DbHasProperty(db, i, DB_SchemaLoaded)==0 ){
            assert( pDb->pSchema->tblHash.count==0 );
            assert( pDb->pSchema==&pDb->pSPool->sSchema );
          }else{
            assert( pDb->pSchema!=&pDb->pSPool->sSchema );







>
|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
static void assert_schema_state_ok(sqlite3 *db){
  if( IsSharedSchema(db) && db->magic!=SQLITE_MAGIC_ZOMBIE ){
    int i;
    for(i=0; i<db->nDb; i++){
      if( i!=1 ){
        Db *pDb = &db->aDb[i];
        Btree *pBt = pDb->pBt;
        if( pBt==0 ) continue;
        assert( sqlite3BtreeSchema(pBt, 0, 0)==0 );
        assert( pDb->pSchema );
        if( pDb->pSPool ){
          if( DbHasProperty(db, i, DB_SchemaLoaded)==0 ){
            assert( pDb->pSchema->tblHash.count==0 );
            assert( pDb->pSchema==&pDb->pSPool->sSchema );
          }else{
            assert( pDb->pSchema!=&pDb->pSPool->sSchema );