aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-11-04 15:23:25 +0000
committerdrh <drh@noemail.net>2013-11-04 15:23:25 +0000
commit6546af1480cf7e8484b0e655f5421bdb5ed8d9d6 (patch)
treef8b0500ada5bad87efdaef065db22ec72d4d8e4e /src/insert.c
parent90e758ff1ffc8e8daca037ea00dcd215e7ebddee (diff)
downloadsqlite-6546af1480cf7e8484b0e655f5421bdb5ed8d9d6.tar.gz
sqlite-6546af1480cf7e8484b0e655f5421bdb5ed8d9d6.zip
Correctly handle changing counting when inserting and deleting on
WITHOUT ROWID tables. Add more FOREIGN KEY test cases. FossilOrigin-Name: d072bcd0a8692d590c13c2bf458454c10c12a3e2
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c
index d49c199f4..3cc88f96f 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1627,9 +1627,12 @@ void sqlite3CompleteInsertion(
sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
}
sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i]);
- if( useSeekResult ){
- sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
+ pik_flags = 0;
+ if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT;
+ if( pIdx->autoIndex==2 && !HasRowid(pTab) && pParse->nested==0 ){
+ pik_flags |= OPFLAG_NCHANGE;
}
+ if( pik_flags ) sqlite3VdbeChangeP5(v, pik_flags);
}
if( !HasRowid(pTab) ) return;
regData = regNewData + 1;