aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-01-27 15:49:32 +0000
committerdrh <drh@noemail.net>2016-01-27 15:49:32 +0000
commitb89aeb6aa2cacdb57ef4bd73f980eb4f16ec52e4 (patch)
tree79ecb4a90c534c411f033fc5cf46e9698bc745b5 /src/insert.c
parent8716bfd8cd280722988d504caf91cb995d13ebdc (diff)
downloadsqlite-b89aeb6aa2cacdb57ef4bd73f980eb4f16ec52e4.tar.gz
sqlite-b89aeb6aa2cacdb57ef4bd73f980eb4f16ec52e4.zip
Add assert() statements on the nExtraDelete variable in vdbe.c to try to verify
that the FORDELETE and IDXDELETE flags are being generated correctly. Those flags are not currently generated correctly, and so the assert()s trip on this check-in. FossilOrigin-Name: dde1db0dd2e2cf04706117629756c352b178ebb8
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c
index 8082bcb45..cbe933c22 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1647,7 +1647,7 @@ int sqlite3OpenTableAndIndices(
Parse *pParse, /* Parsing context */
Table *pTab, /* Table to be opened */
int op, /* OP_OpenRead or OP_OpenWrite */
- u8 p5, /* P5 value for OP_Open* instructions */
+ u8 p5, /* P5 value for OP_Open* opcodes (except on WITHOUT ROWID) */
int iBase, /* Use this for the table cursor, if there is one */
u8 *aToOpen, /* If not NULL: boolean for each table and index */
int *piDataCur, /* Write the database source cursor number here */
@@ -1682,15 +1682,16 @@ int sqlite3OpenTableAndIndices(
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
int iIdxCur = iBase++;
assert( pIdx->pSchema==pTab->pSchema );
- if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) && piDataCur ){
- *piDataCur = iIdxCur;
- }
if( aToOpen==0 || aToOpen[i+1] ){
sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
- sqlite3VdbeChangeP5(v, p5);
VdbeComment((v, "%s", pIdx->zName));
}
+ if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
+ if( piDataCur ) *piDataCur = iIdxCur;
+ }else{
+ sqlite3VdbeChangeP5(v, p5);
+ }
}
if( iBase>pParse->nTab ) pParse->nTab = iBase;
return i;