diff options
author | dan <Dan Kennedy> | 2025-02-13 14:47:25 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2025-02-13 14:47:25 +0000 |
commit | 5087eacb18b6e89291abc15c2818832ae99fd3cc (patch) | |
tree | 43c694901701b601ac54e30f183636d77ba42413 /src | |
parent | 25367c1eb04aa55b47d1e253e5e85cf9e6d7228b (diff) | |
download | sqlite-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 'src')
-rw-r--r-- | src/pragma.c | 5 | ||||
-rw-r--r-- | src/vdbe.c | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/pragma.c b/src/pragma.c index 291ccf7af..f1a922d1a 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1153,7 +1153,10 @@ void sqlite3Pragma( } }else{ db->flags &= ~mask; - if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; + if( mask==SQLITE_DeferFKs ){ + db->nDeferredImmCons = 0; + db->nDeferredCons = 0; + } if( (mask & SQLITE_WriteSchema)!=0 && sqlite3_stricmp(zRight, "reset")==0 ){ diff --git a/src/vdbe.c b/src/vdbe.c index ec871c5a6..6d7769173 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -7483,12 +7483,14 @@ case OP_Param: { /* out2 */ ** statement counter is incremented (immediate foreign key constraints). */ case OP_FkCounter: { - if( db->flags & SQLITE_DeferFKs ){ - db->nDeferredImmCons += pOp->p2; - }else if( pOp->p1 ){ + if( pOp->p1 ){ db->nDeferredCons += pOp->p2; }else{ - p->nFkConstraint += pOp->p2; + if( db->flags & SQLITE_DeferFKs ){ + db->nDeferredImmCons += pOp->p2; + }else{ + p->nFkConstraint += pOp->p2; + } } break; } |