summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/insert3.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/test/insert3.test')
-rw-r--r--third_party/sqlite/test/insert3.test36
1 files changed, 35 insertions, 1 deletions
diff --git a/third_party/sqlite/test/insert3.test b/third_party/sqlite/test/insert3.test
index 825b2ac..6b253e0 100644
--- a/third_party/sqlite/test/insert3.test
+++ b/third_party/sqlite/test/insert3.test
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing corner cases of the INSERT statement.
#
-# $Id: insert3.test,v 1.7 2007/09/12 17:01:45 danielk1977 Exp $
+# $Id: insert3.test,v 1.9 2009/04/23 14:58:40 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -166,6 +166,40 @@ ifcapable bloblit {
}
} {{} 4.3 hi}
}
+
+foreach tab [db eval {SELECT name FROM sqlite_master WHERE type = 'table'}] {
+ db eval "DROP TABLE $tab"
+}
db close
+sqlite3 db test.db
+
+#-------------------------------------------------------------------------
+# While developing tests for a different feature (savepoint) the following
+# sequence was found to cause an assert() in btree.c to fail. These
+# tests are included to ensure that that bug is fixed.
+#
+do_test insert3-4.1 {
+ execsql {
+ CREATE TABLE t1(a, b, c);
+ CREATE INDEX i1 ON t1(a, b);
+ BEGIN;
+ INSERT INTO t1 VALUES(randstr(10,400),randstr(10,400),randstr(10,400));
+ }
+ set r "randstr(10,400)"
+ for {set ii 0} {$ii < 10} {incr ii} {
+ execsql "INSERT INTO t1 SELECT $r, $r, $r FROM t1"
+ }
+ execsql { COMMIT }
+} {}
+do_test insert3-4.2 {
+ execsql {
+ PRAGMA cache_size = 10;
+ BEGIN;
+ UPDATE t1 SET a = randstr(10,10) WHERE (rowid%4)==0;
+ DELETE FROM t1 WHERE rowid%2;
+ INSERT INTO t1 SELECT randstr(10,400), randstr(10,400), c FROM t1;
+ COMMIT;
+ }
+} {}
finish_test