1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Fix a gramfuzz find. If a partial index that does not reference any column

of its table is used by an UPDATE statement in one-pass mode, then avoid the
use of OP_DeferredSeek since the seek might not be resolved prior to the
OP_Delete and OP_Insert that implement the UPDATE.

FossilOrigin-Name: e3398c5ffb060b2b26334b8598e2c63953741e2d6f5124dbd6bdfc8e94742539
This commit is contained in:
drh
2019-12-09 14:34:37 +00:00
parent 38096961c7
commit 7a9698456d
4 changed files with 30 additions and 13 deletions

View File

@@ -1854,10 +1854,10 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( omitTable ){
/* pIdx is a covering index. No need to access the main table. */
}else if( HasRowid(pIdx->pTable) ){
if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE) || (
(pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)
&& (pWInfo->eOnePass==ONEPASS_SINGLE)
)){
if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)
|| ( (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE)!=0
&& (pWInfo->eOnePass==ONEPASS_SINGLE || pLoop->nLTerm==0) )
){
iRowidReg = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);