1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

In the WHERE generator, when building code for a DELETE operation, make sure

that seeks to the main table are not deferred.
This is a better fix for the [16c9801ceba49] bug than the previous.

FossilOrigin-Name: 150dd09ebd7b17234a79e1811a0fae8b0a7a40d5
This commit is contained in:
drh
2016-05-06 16:06:59 +00:00
parent 70077d1733
commit bcf6884afd
7 changed files with 27 additions and 18 deletions

View File

@@ -1324,7 +1324,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( omitTable ){
/* pIdx is a covering index. No need to access the main table. */
}else if( HasRowid(pIdx->pTable) ){
if( pWInfo->eOnePass!=ONEPASS_OFF ){
if( pWInfo->eOnePass!=ONEPASS_OFF
|| (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0
){
iRowidReg = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
@@ -1520,7 +1522,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
wctrlFlags = WHERE_OMIT_OPEN_CLOSE
| WHERE_FORCE_TABLE
| WHERE_ONETABLE_ONLY
| WHERE_NO_AUTOINDEX;
| WHERE_NO_AUTOINDEX
| (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);
for(ii=0; ii<pOrWc->nTerm; ii++){
WhereTerm *pOrTerm = &pOrWc->a[ii];
if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){