Index: src/update.c ================================================================== --- src/update.c +++ src/update.c @@ -350,11 +350,12 @@ /* Begin the database scan */ if( HasRowid(pTab) ){ sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); pWInfo = sqlite3WhereBegin( - pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED, iIdxCur + pParse, pTabList, pWhere, 0, 0, + WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur ); if( pWInfo==0 ) goto update_cleanup; okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); /* Remember the rowid of every item to be updated. Index: src/wherecode.c ================================================================== --- src/wherecode.c +++ src/wherecode.c @@ -1322,13 +1322,11 @@ disableTerm(pLevel, pRangeStart); disableTerm(pLevel, pRangeEnd); if( omitTable ){ /* pIdx is a covering index. No need to access the main table. */ }else if( HasRowid(pIdx->pTable) ){ - if( pWInfo->eOnePass!=ONEPASS_OFF - || (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 - ){ + if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); VdbeCoverage(v); Index: test/intpkey.test ================================================================== --- test/intpkey.test +++ test/intpkey.test @@ -629,11 +629,17 @@ } {248 giraffe} do_execsql_test intpkey-17.1 { DROP INDEX t17x; DELETE FROM t17; INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe'); - CREATE INDEX t17x ON t17(abs(x)); + CREATE UNIQUE INDEX t17x ON t17(abs(x)); DELETE FROM t17 WHERE abs(x) IS NULL OR abs(x)<130; SELECT * FROM t17; } {248 giraffe} +do_execsql_test intpkey-17.2 { + DELETE FROM t17; + INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe'); + UPDATE FROM t17 SET y='ostrich' WHERE abs(x)=248; + SELECT * FROM t17 ORDER BY +x; +} {123 elephant 248 ostrich} finish_test