/ Check-in [f0eed21d4e]
Login

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

Overview
Comment:The implementation of sqlite_rename_column() must be holding the schema mutexes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | alter-table-rename-column
Files: files | file ages | folders
SHA3-256: f0eed21d4e2e1f2c8e680a510a283ac21156c9766efec5b80a362a040424bce7
User & Date: drh 2018-08-25 02:04:05
Context
2018-08-25
03:29
Remove an unnecessary IN_RENAME_COLUMN macro from resolve.c. check-in: 5858c0bde7 user: drh tags: alter-table-rename-column
02:04
The implementation of sqlite_rename_column() must be holding the schema mutexes. check-in: f0eed21d4e user: drh tags: alter-table-rename-column
2018-08-24
20:20
Fix a problem by renaming a column when the schema contains an trigger program featuring an UPSERT that uses an "excluded.*" reference to a different table. check-in: 83d5f5abce user: dan tags: alter-table-rename-column
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

  1205   1205     Table *pTab;
  1206   1206   
  1207   1207     UNUSED_PARAMETER(NotUsed);
  1208   1208     if( zSql==0 ) return;
  1209   1209     if( zTable==0 ) return;
  1210   1210     if( zNew==0 ) return;
  1211   1211     if( iCol<0 ) return;
         1212  +  sqlite3BtreeEnterAll(db);
  1212   1213     pTab = sqlite3FindTable(db, zTable, zDb);
  1213         -  if( pTab==0 || iCol>=pTab->nCol ) return;
         1214  +  if( pTab==0 || iCol>=pTab->nCol ){
         1215  +    sqlite3BtreeLeaveAll(db);
         1216  +    return;
         1217  +  }
  1214   1218     zOld = pTab->aCol[iCol].zName;
  1215   1219     memset(&sCtx, 0, sizeof(sCtx));
  1216   1220     sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol);
  1217   1221   
  1218   1222     /* Parse the SQL statement passed as the first argument. If no error
  1219   1223     ** occurs and the parse does not result in a new table, index or
  1220   1224     ** trigger object, the database must be corrupt. */
................................................................................
  1472   1476     if( sParse.pNewIndex ) sqlite3FreeIndex(db, sParse.pNewIndex);
  1473   1477     sqlite3DeleteTrigger(db, sParse.pNewTrigger);
  1474   1478     renameTokenFree(db, sParse.pRename);
  1475   1479     renameTokenFree(db, sCtx.pList);
  1476   1480     sqlite3DbFree(db, sParse.zErrMsg);
  1477   1481     sqlite3ParserReset(&sParse);
  1478   1482     sqlite3_free(zQuot);
         1483  +  sqlite3BtreeLeaveAll(db);
  1479   1484   }
  1480   1485   
  1481   1486   /*
  1482   1487   ** Register built-in functions used to help implement ALTER TABLE
  1483   1488   */
  1484   1489   void sqlite3AlterFunctions(void){
  1485   1490     static FuncDef aAlterTableFuncs[] = {