aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordan <Dan Kennedy>2025-02-13 14:47:25 +0000
committerdan <Dan Kennedy>2025-02-13 14:47:25 +0000
commit5087eacb18b6e89291abc15c2818832ae99fd3cc (patch)
tree43c694901701b601ac54e30f183636d77ba42413 /test
parent25367c1eb04aa55b47d1e253e5e85cf9e6d7228b (diff)
downloadsqlite-5087eacb18b6e89291abc15c2818832ae99fd3cc.tar.gz
sqlite-5087eacb18b6e89291abc15c2818832ae99fd3cc.zip
Ensure the counts of "deferred FK violations" and "deferred immediate FK violations" are kept separate when "PRAGMA defer_foreign_keys" is used.
FossilOrigin-Name: c5190b0fd9bd76653fb7bb08e931699e42c88cef8a00352360d091948cda93a2
Diffstat (limited to 'test')
-rw-r--r--test/fkey6.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/fkey6.test b/test/fkey6.test
index 72de926b5..7cdc8ab0a 100644
--- a/test/fkey6.test
+++ b/test/fkey6.test
@@ -267,5 +267,35 @@ do_execsql_test 5.1 {
COMMIT;
}
+#-------------------------------------------------------------------------
+#
+reset_db
+
+do_execsql_test 6.1 {
+ PRAGMA writable_schema = 1;
+ INSERT INTO sqlite_schema
+ VALUES('table', 't1', 't1', 2, 'CREATE TABLE t1(x INTEGER PRIMARY KEY)');
+}
+db close
+sqlite3 db test.db
+do_execsql_test 6.1 {
+ PRAGMA foreign_keys = 1;
+ PRAGMA writable_schema = 1;
+}
+do_execsql_test 6.2 {
+ CREATE TABLE t2(
+ y INTEGER PRIMARY KEY,
+ z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED
+ );
+}
+do_execsql_test 6.3 {
+ BEGIN;
+ INSERT INTO t2 VALUES(1,0),(2,1);
+ CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1);
+ INSERT INTO t3 VALUES(3,3);
+ PRAGMA defer_foreign_keys=ON;
+ DELETE FROM t2;
+ COMMIT;
+}
finish_test