Fix a problem with UPDATE and DELETE statements that use both INDEXED BY and LIMIT clauses in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds.

FossilOrigin-Name: cc2b4b38668bd32ebd8cf2e0d244eef2a6c7e0a1ee0a34c9c43eaf25c9cc09ae
This commit is contained in:
dan 2021-02-25 18:23:39 +00:00
parent 3dc864b575
commit a4656e390a
3 changed files with 10 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Fix\shandling\sof\sINSERT\son\sviews\swith\simplicitly\snamed\shidden\scolumns\sin\sSQLITE_ENABLE_HIDDEN_COLUMNS\sbuilds.
D 2021-02-25T16:55:47.813
C Fix\sa\sproblem\swith\sUPDATE\sand\sDELETE\sstatements\sthat\suse\sboth\sINDEXED\sBY\sand\sLIMIT\sclauses\sin\sSQLITE_ENABLE_UPDATE_DELETE_LIMIT\sbuilds.
D 2021-02-25T18:23:39.672
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -493,7 +493,7 @@ F src/ctime.c 2a322b9a3d75771fb4d99e0702851f4f68dda982507a0f798eefb0712969a410
F src/date.c dace306a10d9b02ee553d454c8e1cf8d3c9b932e137738a6b15b90253a9bfc10
F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 3aa79fc3aed7ce906e4ea6c10e85d657299e304f6049861fe300053ac57de36c
F src/delete.c 83dbb8d8c136a100b7a15da38c374b88d82460b3b14f036c169c2d5810223112
F src/delete.c 73f57a9a183532c344a3135cf8f2a5589376e39183e0b5f562d6b61b2af0f4d8
F src/expr.c 6793c836aff149b14011ad546ae1648a18573779ee78f5a7d375f2a3047e8c8e
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c e9063648396c58778f77583a678342fe4a9bc82436bf23c5f9f444f2df0fdaa4
@ -1907,7 +1907,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 911df43f98297bf645688dc51e988106a0297cb60bb97dde699c2848404fcf72
R 541ccd041b03ce231d83952665e3168b
P 15795a96a8b3f4ea368b3eb29a4ff8d1b4b33ebb2bff2a5ccb045b8f01f9f99b
R 3e2336764ffbc96bf6253ff9862eb4d5
U dan
Z 90ed53b5ee6ecc7b7169558c64d4ba1b
Z 568c29fcdf825424835e9b3ed9d8df1e

View File

@ -1 +1 @@
15795a96a8b3f4ea368b3eb29a4ff8d1b4b33ebb2bff2a5ccb045b8f01f9f99b
cc2b4b38668bd32ebd8cf2e0d244eef2a6c7e0a1ee0a34c9c43eaf25c9cc09ae

View File

@ -207,10 +207,12 @@ Expr *sqlite3LimitWhere(
/* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree
** and the SELECT subtree. */
pSrc->a[0].pTab = 0;
pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);
pSelectSrc = sqlite3SrcListDup(db, pSrc, 0);
pSrc->a[0].pTab = pTab;
if( pSrc->a[0].fg.isIndexedBy ){
pSrc->a[0].u2.pIBIndex = 0;
pSrc->a[0].fg.isIndexedBy = 0;
sqlite3DbFree(db, pSrc->a[0].u1.zIndexedBy);
}else if( pSrc->a[0].fg.isCte ){
pSrc->a[0].u2.pCteUse->nUse++;
}