SQLite

Check-in [8fa254aa63]
Login

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

Overview
Comment:Add assert() and ALWAYS() to identify two unreachable branches.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8fa254aa6329bdd085b8e2c78d8e8a698b418eda8b2d48e0082dd9cd428cef29
User & Date: drh 2018-09-07 18:52:25.401
References
2018-09-07
19:12
Remove a faulty ALWAYS() macro added by check-in [8fa254aa6329bdd0]. (check-in: fc47316e9b user: drh tags: trunk)
Context
2018-09-07
18:56
Add extra test case to altertab.test. (check-in: 64c3ee3c25 user: dan tags: trunk)
18:52
Add assert() and ALWAYS() to identify two unreachable branches. (check-in: 8fa254aa63 user: drh tags: trunk)
15:50
Fix a problem with renaming a non-temp table that has at least one temp trigger and shares its name with a temp table. (check-in: ceb60bd7e5 user: dan tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/alter.c.
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
        sNC.pParse = &sParse;
        sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC);
        if( sParse.nErr ) rc = sParse.rc;
      }

      else if( sParse.pNewTrigger ){
        rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
        if( rc==SQLITE_OK ){
          int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
          int i2 = sqlite3FindDbName(db, zDb);
          if( i1==i2 ) sqlite3_result_int(context, 1);
        }
      }
    }








|







1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
        sNC.pParse = &sParse;
        sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC);
        if( sParse.nErr ) rc = sParse.rc;
      }

      else if( sParse.pNewTrigger ){
        rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
        if( ALWAYS(rc==SQLITE_OK) ){
          int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
          int i2 = sqlite3FindDbName(db, zDb);
          if( i1==i2 ) sqlite3_result_int(context, 1);
        }
      }
    }

Changes to src/build.c.
3967
3968
3969
3970
3971
3972
3973


3974
3975
3976
3977
3978
3979
3980
3981
3982
  }
  p = sqlite3SrcListAppend(db, p, pTable, pDatabase);
  if( p==0 ){
    goto append_from_error;
  }
  assert( p->nSrc>0 );
  pItem = &p->a[p->nSrc-1];


  if( IN_RENAME_OBJECT && pItem->zName ){
    Token *pToken = (pDatabase && pDatabase->z) ? pDatabase : pTable;
    sqlite3RenameTokenMap(pParse, pItem->zName, pToken);
  }
  assert( pAlias!=0 );
  if( pAlias->n ){
    pItem->zAlias = sqlite3NameFromToken(db, pAlias);
  }
  pItem->pSelect = pSubquery;







>
>

|







3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
  }
  p = sqlite3SrcListAppend(db, p, pTable, pDatabase);
  if( p==0 ){
    goto append_from_error;
  }
  assert( p->nSrc>0 );
  pItem = &p->a[p->nSrc-1];
  assert( (pTable==0)==(pDatabase==0) );
  assert( pItem->zName==0 || pDatabase!=0 );
  if( IN_RENAME_OBJECT && pItem->zName ){
    Token *pToken = (ALWAYS(pDatabase) && pDatabase->z) ? pDatabase : pTable;
    sqlite3RenameTokenMap(pParse, pItem->zName, pToken);
  }
  assert( pAlias!=0 );
  if( pAlias->n ){
    pItem->zAlias = sqlite3NameFromToken(db, pAlias);
  }
  pItem->pSelect = pSubquery;