]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add tests to check that attempting to DROP a virtual table while it is use does not... nVDestroy
authordan <dan@noemail.net>
Tue, 24 Mar 2015 14:57:21 +0000 (14:57 +0000)
committerdan <dan@noemail.net>
Tue, 24 Mar 2015 14:57:21 +0000 (14:57 +0000)
FossilOrigin-Name: 5ee625b1980f9fab6294d308349dfd9ba960b60b

manifest
manifest.uuid
test/vtab1.test

index faa3a9efb156f07d5c04c273a3f01ff9c9c1f259..f7fe0c82242381ac893f7757fbd35402da81bb99 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C More\sdefenses\sagainst\svirtual\stable\sbeing\sdeleted\sout\sfrom\sunder\sa\srunning\nstatement.
-D 2015-03-24T14:05:50.045
+C Add\stests\sto\scheck\sthat\sattempting\sto\sDROP\sa\svirtual\stable\swhile\sit\sis\suse\sdoes\snot\scause\sproblems.
+D 2015-03-24T14:57:21.959
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 88a3e6261286db378fdffa1124cad11b3c05f5bb
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -1111,7 +1111,7 @@ F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
 F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
 F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
 F test/view.test f311691d696a5cc27e3c1b875cec1b0866b4ccd9
-F test/vtab1.test 1cef14310144718812351a61c5cfb4ba8494a171
+F test/vtab1.test c9dc2a73e93331d70b37ce4b246ef6dc18412fef
 F test/vtab2.test 3644649aa8d1daac57fd541f6a5f914cac59203e
 F test/vtab3.test b45f47d20f225ccc9c28dc915d92740c2dee311e
 F test/vtab4.test 942f8b8280b3ea8a41dae20e7822d065ca1cb275
@@ -1246,7 +1246,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P fba674c083286dabb37fed9357b67593b56ed3a5
-R 6651e18da796c17c1ca503ba6b1b311c
-U drh
-Z 91702967a80a94e761fcc487487cb422
+P 116c99823022c017946b6088878a2d46759deb6e
+R 791eb1db9d6d4dcf9879622b22bdbc4e
+U dan
+Z 5721bb8cdc400d9869a3df977b6ecfb6
index 625bb648cfa7ab27348da251eaa7058b8005e281..5b0b4a1607122be3c36eee9d2026e66559b4cac5 100644 (file)
@@ -1 +1 @@
-116c99823022c017946b6088878a2d46759deb6e
\ No newline at end of file
+5ee625b1980f9fab6294d308349dfd9ba960b60b
\ No newline at end of file
index 2929b1e54d60e272bc928c9a76fe0a793a147301..dfc989a6430e66f69ac721861570070fd9fcbea5 100644 (file)
@@ -1437,4 +1437,58 @@ ifcapable fts3 {
   } {SQLITE_OK}
 }
 
+
+#-------------------------------------------------------------------------
+# The following tests verify that a DROP TABLE command on a virtual
+# table does not cause other operations to crash.
+#
+#   23.1: Dropping a vtab while a SELECT is running on it.
+#
+#   23.2: Dropping a vtab while a SELECT that will, but has not yet,
+#         open a cursor on the vtab, is running. In this case the
+#         DROP TABLE succeeds and the SELECT hits an error.
+#   
+#   23.3: Dropping a vtab from within a user-defined-function callback
+#         in the middle of an "INSERT INTO vtab SELECT ..." statement.
+#
+reset_db
+load_static_extension db wholenumber
+load_static_extension db eval
+register_echo_module db
+
+do_test 23.1 {
+  execsql { CREATE VIRTUAL TABLE t1 USING wholenumber }
+  set res ""
+  db eval { SELECT value FROM t1 WHERE value<10 } {
+    if {$value == 5} {
+      set res [catchsql { DROP TABLE t1 }]
+    }
+  }
+  set res
+} {1 {database table is locked}}
+
+do_test 23.2 {
+  execsql { 
+    CREATE TABLE t2(value);
+    INSERT INTO t2 VALUES(1), (2), (3);
+  }
+
+  set res2 [list [catch {
+    db eval {
+      SELECT value FROM t2 UNION ALL 
+      SELECT value FROM t1 WHERE value<10
+    } {
+      if {$value == 2} { set res1 [catchsql { DROP TABLE t1 }] }
+    }
+  } msg] $msg]
+  list $res1 $res2
+} {{0 {}} {1 {database table is locked}}}
+
+do_test 23.3.1 {
+  execsql { CREATE VIRTUAL TABLE t1e USING echo(t2) }
+  execsql { INSERT INTO t1e SELECT 4 }
+  catchsql { INSERT INTO t1e SELECT eval('DROP TABLE t1e') }
+} {1 {database table is locked}}
+do_execsql_test 23.3.2 { SELECT * FROM t1e } {1 2 3 4}
+
 finish_test