/ Check-in [fa835145]
Login

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

Overview
Comment:Fix a problem in ALTER TABLE with SQLITE_OMIT_VIRTUALTABLE builds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fa835145e63749e06e04bd50ff992afaeae05dcdd1df597d13911f944e62076b
User & Date: dan 2018-09-06 17:47:09
Context
2018-09-06
18:56
Fix a problem with ALTER TABLE when there are views or triggers in the schema that contain "<expr> IS NULL" expressions. check-in: 91aab32e user: dan tags: trunk
17:47
Fix a problem in ALTER TABLE with SQLITE_OMIT_VIRTUALTABLE builds. check-in: fa835145 user: dan tags: trunk
17:23
Fix test script problems causing SQLITE_OMIT_VIRTUALTABLE builds to fail. check-in: 37ad064e user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

   478    478   */
   479    479   #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
   480    480   static int isRealTable(Parse *pParse, Table *pTab){
   481    481     const char *zType = 0;
   482    482   #ifndef SQLITE_OMIT_VIEW
   483    483     if( pTab->pSelect ){
   484    484       zType = "view";
   485         -  }else 
          485  +  }
   486    486   #endif
   487    487   #ifndef SQLITE_OMIT_VIRTUALTABLE
   488    488     if( IsVirtual(pTab) ){
   489    489       zType = "virtual table";
   490    490     }
   491    491   #endif
   492    492     if( zType ){

Changes to test/altertab.test.

   205    205   
   206    206   do_catchsql_test 5.6 {
   207    207     ALTER TABLE t2 RENAME TO one;
   208    208   } {1 {error in view vv after rename: ambiguous column name: one.a}}
   209    209   
   210    210   #-------------------------------------------------------------------------
   211    211   
   212         -register_tcl_module db
   213         -proc tcl_command {method args} {
   214         -  switch -- $method {
   215         -    xConnect {
   216         -      return "CREATE TABLE t1(a, b, c)"
          212  +ifcapable vtab {
          213  +  register_tcl_module db
          214  +  proc tcl_command {method args} {
          215  +    switch -- $method {
          216  +      xConnect {
          217  +        return "CREATE TABLE t1(a, b, c)"
          218  +      }
   217    219       }
          220  +    return {}
          221  +  }
          222  +  
          223  +  do_execsql_test 6.0 {
          224  +    CREATE VIRTUAL TABLE x1 USING tcl(tcl_command);
   218    225     }
   219         -  return {}
   220         -}
   221         -
   222         -do_execsql_test 6.0 {
   223         -  CREATE VIRTUAL TABLE x1 USING tcl(tcl_command);
   224         -}
   225         -
   226         -do_execsql_test 6.1 {
   227         -  ALTER TABLE x1 RENAME TO x2;
   228         -  SELECT sql FROM sqlite_master WHERE name = 'x2'
   229         -} {{CREATE VIRTUAL TABLE "x2" USING tcl(tcl_command)}}
   230         -
   231         -do_execsql_test 7.1 {
   232         -  CREATE TABLE ddd(db, sql, zOld, zNew, bTemp);
   233         -  INSERT INTO ddd VALUES(
   234         -      'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', 'ddd', NULL, 0
   235         -  ), (
   236         -      'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', NULL, 'eee', 0
   237         -  ), (
   238         -      'main', NULL, 'ddd', 'eee', 0
   239         -  );
   240         -} {}
   241         -
   242         -do_execsql_test 7.2 {
   243         -  SELECT 
   244         -  sqlite_rename_table(db, 0, 0, sql, zOld, zNew, bTemp)
   245         -  FROM ddd;
   246         -} {{} {} {}}
          226  +  
          227  +  do_execsql_test 6.1 {
          228  +    ALTER TABLE x1 RENAME TO x2;
          229  +    SELECT sql FROM sqlite_master WHERE name = 'x2'
          230  +  } {{CREATE VIRTUAL TABLE "x2" USING tcl(tcl_command)}}
          231  +  
          232  +  do_execsql_test 7.1 {
          233  +    CREATE TABLE ddd(db, sql, zOld, zNew, bTemp);
          234  +    INSERT INTO ddd VALUES(
          235  +        'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', 'ddd', NULL, 0
          236  +    ), (
          237  +        'main', 'CREATE TABLE x1(i INTEGER, t TEXT)', NULL, 'eee', 0
          238  +    ), (
          239  +        'main', NULL, 'ddd', 'eee', 0
          240  +    );
          241  +  } {}
          242  +  
          243  +  do_execsql_test 7.2 {
          244  +    SELECT 
          245  +    sqlite_rename_table(db, 0, 0, sql, zOld, zNew, bTemp)
          246  +    FROM ddd;
          247  +  } {{} {} {}}
          248  +}
   247    249   
   248    250   #-------------------------------------------------------------------------
   249    251   #
   250    252   reset_db
   251    253   forcedelete test.db2
   252    254   do_execsql_test 8.1 {
   253    255     ATTACH 'test.db2' AS aux;

Changes to test/auth.test.

  2140   2140   #    MAIN: CREATE TABLE "t2"(a,b,c);
  2141   2141   #    MAIN: CREATE TABLE t4(a,b,c);
  2142   2142   #    MAIN: CREATE INDEX t4i1 ON t4(a);
  2143   2143   #    MAIN: CREATE INDEX t4i2 ON t4(b,a,c);
  2144   2144   #    MAIN: CREATE TABLE sqlite_stat1(tbl,idx,stat);
  2145   2145   #    MAIN: CREATE TABLE t1(a,b);
  2146   2146   #
  2147         -ifcapable altertable {
         2147  +ifcapable altertable&&vtab {
  2148   2148     do_test 1.350 {
  2149   2149       proc auth {code arg1 arg2 arg3 arg4 args} {
  2150   2150         if {$code=="SQLITE_ALTER_TABLE"} {
  2151   2151           set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  2152   2152           return SQLITE_OK
  2153   2153         }
  2154   2154         return SQLITE_OK