aboutsummaryrefslogtreecommitdiff
path: root/test/pragma.test
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-08-06 01:25:47 +0000
committerdrh <drh@noemail.net>2014-08-06 01:25:47 +0000
commit58c4cbe152e39baadd2e9df87013d23f16c20a66 (patch)
tree1160ce6260d6901566131cb75e8d3b478aa8b1cb /test/pragma.test
parent39a7bfd361768dcd89bcf987c1582daafae19819 (diff)
parentbc5cf3813ea1bf56ed19a35028061e779827fffc (diff)
downloadsqlite-58c4cbe152e39baadd2e9df87013d23f16c20a66.tar.gz
sqlite-58c4cbe152e39baadd2e9df87013d23f16c20a66.zip
Merge the latest 3.8.6 beta changes from trunk.
FossilOrigin-Name: 68a6d5e2f43702c78057ae2f2a7345c981d24e17
Diffstat (limited to 'test/pragma.test')
-rw-r--r--test/pragma.test27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/pragma.test b/test/pragma.test
index 8f54e695d..539d86736 100644
--- a/test/pragma.test
+++ b/test/pragma.test
@@ -431,7 +431,32 @@ Page 6 is never used} {row 1 missing from index i2}}
db eval {PRAGMA integrity_check}
} {ok}
}
-#exit
+
+# Verify that PRAGMA integrity_check catches UNIQUE and NOT NULL
+# constraint violations.
+#
+do_execsql_test pragma-3.20 {
+ CREATE TABLE t1(a,b);
+ CREATE INDEX t1a ON t1(a);
+ INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(2,4),(NULL,5),(NULL,6);
+ PRAGMA writable_schema=ON;
+ UPDATE sqlite_master SET sql='CREATE UNIQUE INDEX t1a ON t1(a)'
+ WHERE name='t1a';
+ UPDATE sqlite_master SET sql='CREATE TABLE t1(a NOT NULL,b)'
+ WHERE name='t1';
+ PRAGMA writable_schema=OFF;
+ ALTER TABLE t1 RENAME TO t1x;
+ PRAGMA integrity_check;
+} {{non-unique entry in index t1a} {NULL value in t1x.a} {non-unique entry in index t1a} {NULL value in t1x.a}}
+do_execsql_test pragma-3.21 {
+ PRAGMA integrity_check(3);
+} {{non-unique entry in index t1a} {NULL value in t1x.a} {non-unique entry in index t1a}}
+do_execsql_test pragma-3.22 {
+ PRAGMA integrity_check(2);
+} {{non-unique entry in index t1a} {NULL value in t1x.a}}
+do_execsql_test pragma-3.21 {
+ PRAGMA integrity_check(1);
+} {{non-unique entry in index t1a}}
# Test modifying the cache_size of an attached database.
ifcapable pager_pragmas&&attach {