1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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
This commit is contained in:
dan
2025-02-13 14:47:25 +00:00
parent 25367c1eb0
commit 5087eacb18
5 changed files with 49 additions and 14 deletions

View File

@ -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