Index: third_party/sqlite/src/test/wal6.test |
diff --git a/third_party/sqlite/src/test/wal6.test b/third_party/sqlite/src/test/wal6.test |
index d96166ef5975eef37f4c7af86caa419ead663a90..9bbc58409d623642547a595e066e3783c9e6862e 100644 |
--- a/third_party/sqlite/src/test/wal6.test |
+++ b/third_party/sqlite/src/test/wal6.test |
@@ -234,6 +234,36 @@ do_test 4.4.2 { |
catchsql { SELECT * FROM t2 } db2 |
} {1 {database disk image is malformed}} |
+#------------------------------------------------------------------------- |
+# Confirm that it is possible to get an SQLITE_BUSY_SNAPSHOT error from |
+# "BEGIN EXCLUSIVE" if the connection already has an open read-transaction. |
+# |
+db close |
+db2 close |
+reset_db |
+sqlite3 db2 test.db |
+do_execsql_test 5.1 { |
+ PRAGMA journal_mode = wal; |
+ CREATE TABLE t1(x, y); |
+ INSERT INTO t1 VALUES(1, 2); |
+ INSERT INTO t1 VALUES(3, 4); |
+} {wal} |
+do_test 5.2 { |
+ set res [list] |
+ db eval { |
+ SELECT * FROM t1 |
+ } { |
+ if {$x==1} { |
+ db2 eval { INSERT INTO t1 VALUES(5, 6) } |
+ } |
+ if {$x==3} { |
+ set res [catchsql {BEGIN EXCLUSIVE}] |
+ lappend res [sqlite3_extended_errcode db] |
+ } |
+ } |
+ set res |
+} {1 {database is locked} SQLITE_BUSY_SNAPSHOT} |
-finish_test |
+ |
+finish_test |