Skip to content

Commit 493f9ab

Browse files
committed
Fix a problem with UPDATE and DELETE statements that use both INDEXED BY and LIMIT clauses in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds.
1 parent f02d47d commit 493f9ab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/delete.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,12 @@ Expr *sqlite3LimitWhere(
207207
/* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
208208
** and the SELECT subtree. */
209209
pSrc->a[0].pTab = 0;
210-
pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
210+
pSelectSrc = sqlite3SrcListDup(db, pSrc, 0);
211211
pSrc->a[0].pTab = pTab;
212212
if( pSrc->a[0].fg.isIndexedBy ){
213213
pSrc->a[0].u2.pIBIndex = 0;
214+
pSrc->a[0].fg.isIndexedBy = 0;
215+
sqlite3DbFree(db, pSrc->a[0].u1.zIndexedBy);
214216
}else if( pSrc->a[0].fg.isCte ){
215217
pSrc->a[0].u2.pCteUse->nUse++;
216218
}

0 commit comments

Comments
 (0)