/ Check-in [42fc08bc]
Login

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

Overview
Comment:Do not allow ALTER TABLE ADD COLUMN for a STORED column.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | generated-columns
Files: files | file ages | folders
SHA3-256: 42fc08bc1528a34a603c2c085b515766a8d33ae7ea0350a52b0ca24b94ebcbc5
User & Date: drh 2019-10-24 01:04:10
Context
2019-10-24
20:29
Fix handling of covering indexes that use virtual columns. check-in: e0f7e321 user: drh tags: generated-columns
01:04
Do not allow ALTER TABLE ADD COLUMN for a STORED column. check-in: 42fc08bc user: drh tags: generated-columns
2019-10-23
15:47
Minor adjustments for clarity and test coverage. check-in: 30065716 user: drh tags: generated-columns
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/alter.c.

345
346
347
348
349
350
351



352
353
354
355
356
357
358
      }
      if( !pVal ){
        sqlite3ErrorMsg(pParse,"Cannot add a column with non-constant default");
        return;
      }
      sqlite3ValueFree(pVal);
    }



  }


  /* Modify the CREATE TABLE statement. */
  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);
  if( zCol ){
    char *zEnd = &zCol[pColDef->n-1];







>
>
>







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
      }
      if( !pVal ){
        sqlite3ErrorMsg(pParse,"Cannot add a column with non-constant default");
        return;
      }
      sqlite3ValueFree(pVal);
    }
  }else if( pCol->colFlags & COLFLAG_STORED ){
    sqlite3ErrorMsg(pParse, "cannot add a STORED column");
    return;
  }


  /* Modify the CREATE TABLE statement. */
  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);
  if( zCol ){
    char *zEnd = &zCol[pColDef->n-1];