/ 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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8fa254aa6329bdd085b8e2c78d8e8a698b418eda8b2d48e0082dd9cd428cef29
User & Date: drh 2018-09-07 18:52:25
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
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

  1535   1535           sNC.pParse = &sParse;
  1536   1536           sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC);
  1537   1537           if( sParse.nErr ) rc = sParse.rc;
  1538   1538         }
  1539   1539   
  1540   1540         else if( sParse.pNewTrigger ){
  1541   1541           rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
  1542         -        if( rc==SQLITE_OK ){
         1542  +        if( ALWAYS(rc==SQLITE_OK) ){
  1543   1543             int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
  1544   1544             int i2 = sqlite3FindDbName(db, zDb);
  1545   1545             if( i1==i2 ) sqlite3_result_int(context, 1);
  1546   1546           }
  1547   1547         }
  1548   1548       }
  1549   1549   

Changes to src/build.c.

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