From: drh <> Date: Thu, 23 Jun 2022 20:56:45 +0000 (+0000) Subject: Reintroduce flattener constraint (3c), but this time make it apply only if X-Git-Tag: version-3.40.0~352^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a6e0c3f0419779785295d263fe990944962d0a1;p=thirdparty%2Fsqlite.git Reintroduce flattener constraint (3c), but this time make it apply only if the outer query holds a GROUP BY, not if the outer query is an aggregate. FossilOrigin-Name: 641dfb9182a6cbadb3c452f5420f896791b7844b794f693443bcd38dca14da35 --- diff --git a/manifest b/manifest index e7bdf38766..9ad0a00791 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sback\sthe\sability\sto\sflatten\sa\sLEFT\sJOIN\ssubquery\s-\spreviously\sremoved\ndue\sto\sticket\s[cad1ab4cb7b0fc344]. -D 2022-06-23T15:15:03.618 +C Reintroduce\sflattener\sconstraint\s(3c),\sbut\sthis\stime\smake\sit\sapply\sonly\sif\nthe\souter\squery\sholds\sa\sGROUP\sBY,\snot\sif\sthe\souter\squery\sis\san\saggregate. +D 2022-06-23T20:56:45.105 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -570,7 +570,7 @@ F src/printf.c 6166a30417b05c5b2f82e1f183f75faa2926ad60531c0b688a57dbc951441a20 F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c F src/resolve.c 1655e44c77c51ebbe82924287528a78bd4a4aaaf34189dbae28d19ccf2ca615c F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 -F src/select.c 0e07ed5e7dc93ebdc0b5ed4760e147417c30709a2697f263876357009673eb1c +F src/select.c 8b62787f6985bcfd802978f9e819c4458dd068fef183b087925a1833e831eccd F src/shell.c.in 08e59f1cb9d9b1180aba52861aaada0c95f6ddd210488719684e160a0724c806 F src/sqlite.h.in 172528c287399a34f188154017b7268bf82c6d5b780902e361958d2318c4e37c F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -1978,11 +1978,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 5fa00959ebc3a46fe400564d5a30e8c44857cd4f0473fb25e84154019eff3f39 -R 7c9e5bbcdf37f239d91e48a825683444 -T *branch * flatten-left-join -T *sym-flatten-left-join * -T -sym-trunk * +P f8fe936ad4f7678f9b26ba6fab41c5df9f4938634cdb3286b0f2dcd1357f919a +R 83ca326ff6a26325b2e0f5cb84056d0f U drh -Z b50ebd17a3c7c4abceffd64a112d48b3 +Z 3bf3bb97c304e358370c1c605007c0f4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 65826fbe1b..e3c034aad7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f8fe936ad4f7678f9b26ba6fab41c5df9f4938634cdb3286b0f2dcd1357f919a \ No newline at end of file +641dfb9182a6cbadb3c452f5420f896791b7844b794f693443bcd38dca14da35 \ No newline at end of file diff --git a/src/select.c b/src/select.c index 12bca38bf8..d3bbd86bb3 100644 --- a/src/select.c +++ b/src/select.c @@ -4068,7 +4068,7 @@ static void renumberCursors( ** (3a) the subquery may not be a join and ** (3b) the FROM clause of the subquery may not contain a virtual ** table and -** (**) REMOVED. Was: the outer query may not be an aggregate. +** (3c) The outer query may not have a GROUP BY ** (3d) the outer query may not be DISTINCT. ** See also (26) for restrictions on RIGHT JOIN. ** @@ -4279,6 +4279,7 @@ static int flattenSubquery( if( pSubSrc->nSrc>1 /* (3a) */ || IsVirtual(pSubSrc->a[0].pTab) /* (3b) */ || (p->selFlags & SF_Distinct)!=0 /* (3d) */ + || (p->pGroupBy!=0) /* (3c) */ || (pSubitem->fg.jointype & JT_RIGHT)!=0 /* (26) */ ){ return 0;