diff options
author | drh <drh@noemail.net> | 2013-11-26 23:27:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-11-26 23:27:07 +0000 |
commit | bbbb0e8053a82fabc371c32b2a95497378a7d72f (patch) | |
tree | e39535bbd691c40143014d926cb13788db3bf08f /src | |
parent | 2c7e9bfc5013769d1cd149909b1d687173cefd65 (diff) | |
download | sqlite-bbbb0e8053a82fabc371c32b2a95497378a7d72f.tar.gz sqlite-bbbb0e8053a82fabc371c32b2a95497378a7d72f.zip |
Make sure the update hook is not invoked for WITHOUT ROWID tables, as
the documentation specifies. This bug was found while adding requirements
marks, so a few extraneous requirements marks are included in this
check-in.
FossilOrigin-Name: 0978bac6b8aee229d7a0d148546f50d380d06a06
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve.c | 4 | ||||
-rw-r--r-- | src/vdbe.c | 13 |
2 files changed, 5 insertions, 12 deletions
diff --git a/src/resolve.c b/src/resolve.c index 2c0907cc4..b0adb8629 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -352,7 +352,9 @@ static int lookupName( } } if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && HasRowid(pTab) ){ - iCol = -1; /* IMP: R-44911-55124 */ + /* IMP: R-24309-18625 */ + /* IMP: R-44911-55124 */ + iCol = -1; } if( iCol<pTab->nCol ){ cnt++; diff --git a/src/vdbe.c b/src/vdbe.c index b402a5e6c..3b27ba144 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -4109,20 +4109,11 @@ case OP_Delete: { i64 iKey; VdbeCursor *pC; - iKey = 0; assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); assert( pC->pCursor!=0 ); /* Only valid for real tables, no pseudotables */ - - /* If the update-hook will be invoked, set iKey to the rowid of the - ** row being deleted. - */ - if( db->xUpdateCallback && pOp->p4.z ){ - assert( pC->isTable ); - assert( pC->rowidIsValid ); /* lastRowid set by previous OP_NotFound */ - iKey = pC->lastRowid; - } + iKey = pC->lastRowid; /* Only used for the update hook */ /* The OP_Delete opcode always follows an OP_NotExists or OP_Last or ** OP_Column on the same table without any intervening operations that @@ -4140,7 +4131,7 @@ case OP_Delete: { pC->cacheStatus = CACHE_STALE; /* Invoke the update-hook if required. */ - if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){ + if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z && pC->isTable ){ const char *zDb = db->aDb[pC->iDb].zName; const char *zTbl = pOp->p4.z; db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, zTbl, iKey); |