From: drh <> Date: Fri, 28 May 2021 12:48:31 +0000 (+0000) Subject: Make a deep copy of the result of a subquery in case the subquery is X-Git-Tag: version-3.36.0~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e9de65201c7630f9b587b8b14d1caecf2ca4c8d4;p=thirdparty%2Fsqlite.git Make a deep copy of the result of a subquery in case the subquery is reused. Fix for the problem reported by [forum:/forumpost/28216b36ac|forum post 28216b36ac] and introduced by check-in [f30fb19ff763a7cb]. Further changes to try to optimize the new OP_Copy opcode back into either OP_SCopy or OP_Move will be attempted separately. A test case will be in TH3. FossilOrigin-Name: c9f0b9cb0aef107265435e22c164dd3c974eadfd00abf7cfd4fc7ec95c0dd7d0 --- diff --git a/manifest b/manifest index 5c1230994a..cc15943c16 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\spotential\smemory\sleak\sin\sjson_group_object()\sfollowing\san\serror.\ndbsqlfuzz\scd32630de3ff039d97089592b63cb3616f8ec9dd -D 2021-05-28T12:15:19.049 +C Make\sa\sdeep\scopy\sof\sthe\sresult\sof\sa\ssubquery\sin\scase\sthe\ssubquery\sis\nreused.\s\sFix\sfor\sthe\sproblem\sreported\sby\n[forum:/forumpost/28216b36ac|forum\spost\s28216b36ac]\sand\sintroduced\sby\ncheck-in\s[f30fb19ff763a7cb].\s\sFurther\schanges\sto\stry\sto\soptimize\sthe\snew\nOP_Copy\sopcode\sback\sinto\seither\sOP_SCopy\sor\sOP_Move\swill\sbe\sattempted\nseparately.\s\sA\stest\scase\swill\sbe\sin\sTH3. +D 2021-05-28T12:48:31.685 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -633,7 +633,7 @@ F src/wal.h c3aa7825bfa2fe0d85bef2db94655f99870a285778baa36307c0a16da32b226a F src/walker.c 7342becedf3f8a26f9817f08436bdf8b56ad69af83705f6b9320a0ad3092c2ac F src/where.c 32f41c3c93c6785e0077e3a2cdc669c3ccfe70173787847be77f294c18fc7dc3 F src/whereInt.h 9248161dd004f625ce5d3841ca9b99fed3fc8d61522cf76340fc5217dbe1375b -F src/wherecode.c b40f3addc024e546dd6c3c93261b0f484e98597bbde04f2a04b95dd570e00d02 +F src/wherecode.c 9f1f65d11437b25cd0a1497a170514c785f19ce6ad9d3e6fc73719cb5a49012f F src/whereexpr.c 5a9c9f5d2dac4bcdcaae3035034b4667523f731df228e0bb1d4efc669efa9da5 F src/window.c a6d624d83b2d5b3cfb82bb437a2fbae759c928d47dc9ad1338a9419269181bb2 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 @@ -1918,7 +1918,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 f958ffbc61c693b71538cc3aa5f95ce0f0b5d4906efbb0c075f543e19883a669 -R 96a7d9abe665dfd5611578e638dd272f +P 21676731cedae27d1ab9fe62b269001ae6e3eeb3caa87b4f5536f777631a8bbc +R 77e951a6e7b5327d1f646c5968da6983 U drh -Z d6e9a2d658f734ee79d64b1f37f13952 +Z 20c9ad1ef6610380252081cdda3138d3 diff --git a/manifest.uuid b/manifest.uuid index 5105b37eab..f8745ea2ba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -21676731cedae27d1ab9fe62b269001ae6e3eeb3caa87b4f5536f777631a8bbc \ No newline at end of file +c9f0b9cb0aef107265435e22c164dd3c974eadfd00abf7cfd4fc7ec95c0dd7d0 \ No newline at end of file diff --git a/src/wherecode.c b/src/wherecode.c index 71ba9f7633..84fa1a1410 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -756,7 +756,7 @@ static int codeAllEqualityTerms( sqlite3ReleaseTempReg(pParse, regBase); regBase = r1; }else{ - sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j); + sqlite3VdbeAddOp2(v, OP_Copy, r1, regBase+j); } } if( pTerm->eOperator & WO_IN ){