/ Check-in [a7dae59a7e]
Login

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

Overview
Comment:Fix harmless compiler warnings in the ALTER TABLE logic. Rephrase an error message to use active voice.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | alter-table-rename-column
Files: files | file ages | folders
SHA3-256: a7dae59a7e7b187fa2e9457bbb4b01cfe3d48bbdf59c3f8f7b4156bcde3bda98
User & Date: drh 2018-08-23 19:32:04
Context
2018-08-23
20:09
Add the "atrc" test program to the Makefiles. Fix a typo in the instructions in the header comment of the atrc program. check-in: 2130a407dd user: drh tags: alter-table-rename-column
19:32
Fix harmless compiler warnings in the ALTER TABLE logic. Rephrase an error message to use active voice. check-in: a7dae59a7e user: drh tags: alter-table-rename-column
18:50
The Expr.iColumn field must also be initialized in tokenExpr(). check-in: 772985f18b user: drh tags: alter-table-rename-column
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

   809    809   #ifndef SQLITE_OMIT_VIRTUALTABLE
   810    810     if( IsVirtual(pTab) ){
   811    811       zType = "virtual table";
   812    812     }
   813    813   #endif
   814    814     if( zType ){
   815    815       sqlite3ErrorMsg(
   816         -        pParse, "columns of %s %s may not be renamed", zType, pTab->zName
          816  +        pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName
   817    817       );
   818    818       return 1;
   819    819     }
   820    820     return 0;
   821    821   }
   822    822   #else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */
   823    823   # define isRealTable(x,y) (0)
................................................................................
  1069   1069   */
  1070   1070   static void renameColumnParseError(
  1071   1071     sqlite3_context *pCtx, 
  1072   1072     sqlite3_value *pType,
  1073   1073     sqlite3_value *pObject,
  1074   1074     Parse *pParse
  1075   1075   ){
  1076         -  const char *zT = sqlite3_value_text(pType);
  1077         -  const char *zN = sqlite3_value_text(pObject);
         1076  +  const char *zT = (const char*)sqlite3_value_text(pType);
         1077  +  const char *zN = (const char*)sqlite3_value_text(pObject);
  1078   1078     char *zErr;
  1079   1079   
  1080   1080     zErr = sqlite3_mprintf("error processing %s %s: %s", zT, zN, pParse->zErrMsg);
  1081   1081     sqlite3_result_error(pCtx, zErr, -1);
  1082   1082     sqlite3_free(zErr);
  1083   1083   }
  1084   1084   

Changes to test/altercol.test.

   499    499   
   500    500   do_execsql_test 12.2.1 {
   501    501     CREATE VIEW v1 AS SELECT * FROM t1;
   502    502     CREATE VIEW v2(c, d) AS SELECT * FROM t1;
   503    503   }
   504    504   do_catchsql_test 12.2.2 {
   505    505     ALTER TABLE v1 RENAME a TO z;
   506         -} {1 {columns of view v1 may not be renamed}}
          506  +} {1 {cannot rename columns of view "v1"}}
   507    507   do_catchsql_test 12.2.3 {
   508    508     ALTER TABLE v2 RENAME c TO y;
   509         -} {1 {columns of view v2 may not be renamed}}
          509  +} {1 {cannot rename columns of view "v2"}}
   510    510   
   511    511   ifcapable fts5 {
   512    512     do_execsql_test 12.3.1 {
   513    513       CREATE VIRTUAL TABLE ft USING fts5(a, b, c);
   514    514     }
   515    515     do_catchsql_test 12.3.2 {
   516    516       ALTER TABLE ft RENAME a TO z;
................................................................................
   631    631     SELECT 
   632    632     sqlite_rename_column(sql, type, object, db, tbl, icol, znew, bquote)
   633    633     FROM ddd;
   634    634   } {{} {} {}}
   635    635   
   636    636   
   637    637   finish_test
   638         -