/ Check-in [2f5be3a2]
Login

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

Overview
Comment:When dropping a view, skip trying to delete from 'sqlite_stat*'.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dropViewNoStat
Files: files | file ages | folders
SHA3-256:2f5be3a2ddf469bd1b37b9e357545ce872b90c479a07094de2101d0a43ad70a4
User & Date: mistachkin 2018-07-20 20:56:22
Context
2018-07-22
00:45
Remove an unused branch in the FK logic. Closed-Leaf check-in: 523ff779 user: drh tags: dropViewNoStat
2018-07-20
20:56
When dropping a view, skip trying to delete from 'sqlite_stat*'. check-in: 2f5be3a2 user: mistachkin tags: dropViewNoStat
19:24
Change the SQLITE_Stat34 bit of the optimization test-control so that it prevents STAT4 data from being used but allows it to be loaded into the Index objects. This permits STAT4 to be turned on and off on a per-statement basis. check-in: 489f3caf user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

2658
2659
2660
2661
2662
2663
2664

2665
2666

2667
2668
2669
2670
2671
2672
2673

  /* Generate code to remove the table from the master table
  ** on disk.
  */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3BeginWriteOperation(pParse, 1, iDb);

    sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
    sqlite3FkDropTable(pParse, pName, pTab);

    sqlite3CodeDropTable(pParse, pTab, iDb, isView);
  }

exit_drop_table:
  sqlite3SrcListDelete(db, pName);
}








>
|
|
>







2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675

  /* Generate code to remove the table from the master table
  ** on disk.
  */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3BeginWriteOperation(pParse, 1, iDb);
    if( !isView ){
      sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
      sqlite3FkDropTable(pParse, pName, pTab);
    }
    sqlite3CodeDropTable(pParse, pTab, iDb, isView);
  }

exit_drop_table:
  sqlite3SrcListDelete(db, pName);
}

Changes to test/view.test.

670
671
672
673
674
675
676





677

















678
} {123 234 345}
do_test view-22.2 {
  unset -nocomplain x
  db eval {SELECT * FROM x1} x break
  lsort [array names x]
} {{} * :1 :2}
























finish_test







>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
} {123 234 345}
do_test view-22.2 {
  unset -nocomplain x
  db eval {SELECT * FROM x1} x break
  lsort [array names x]
} {{} * :1 :2}

do_test view-25.1 {
  db eval {
    CREATE TABLE t25 (x);
    INSERT INTO t25 (x) VALUES (1);
    ANALYZE;
  }
  proc authLogDelete {code arg1 arg2 arg3 arg4 args} {
    if {$code=="SQLITE_DELETE" && [string match sqlite_stat* $arg1]} {
      lappend ::log [list $code $arg1 $arg2 $arg3 $arg4 $args]
    }
    return SQLITE_OK
  }
  set log ""
  db authorizer ::authLogDelete
  db eval {DROP VIEW x1;}
  set log
} {}
do_test view-25.2 {
  set log ""
  db eval {DROP TABLE t25;}
  set log
} {{SQLITE_DELETE sqlite_stat1 {} main {} {}}}

finish_test