1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Simplify the fix in the previous commit.

FossilOrigin-Name: 5ef64b0f55d952c7b0016055eaf6bbc1b5b7afc09a62ee8e5e694ffa9863ac7c
This commit is contained in:
dan
2019-09-20 21:12:40 +00:00
parent ed09dddece
commit af9b58b335
3 changed files with 12 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\sproblem\swith\squeries\scontaining\sa\smin()\sor\smax()\sfunction\sfor\swhich\sthe\sFILTER\sclause\sexcludes\sall\srows. C Simplify\sthe\sfix\sin\sthe\sprevious\scommit.
D 2019-09-20T20:52:16.031 D 2019-09-20T21:12:40.662
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -525,7 +525,7 @@ F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 9891cf5fd155bb199f8b1ff5d1429b9f70484487f4c455bba94348d4cb6f829f F src/resolve.c 9891cf5fd155bb199f8b1ff5d1429b9f70484487f4c455bba94348d4cb6f829f
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c fd3ef107dfa6cdad83b76abc04c48411ba6103624f19a867954232ec7fb5edc7 F src/select.c 446a2bdd217ef6a4e4af134ba2e92bedebc9d0b9cb199f7c2235bc986b544a03
F src/shell.c.in 68698630c21c5489fb3dc961a3ab3840e726c3c01e475dab96055788a7b6e5e6 F src/shell.c.in 68698630c21c5489fb3dc961a3ab3840e726c3c01e475dab96055788a7b6e5e6
F src/sqlite.h.in 5725a6b20190a1e8d662077a1c1c8ea889ad7be90dd803f914c2de226f5fe6ab F src/sqlite.h.in 5725a6b20190a1e8d662077a1c1c8ea889ad7be90dd803f914c2de226f5fe6ab
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
@@ -1844,7 +1844,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 601ce9532d34f97a5faa170b6d8a272e5c54f2eabff84660201a1840e0fd9929 P b1d7e104e034655fe41bc55c562d91e8074a2973d538b8b29301458db45afc57
R 3f32110f8bafe29b4265ff0c8cd184cc R 6590f6fec6e23fb5ea7f662e774ed7b7
U dan U dan
Z 38f3480169c6f6b8dfb01762d9e1b1b0 Z ff79fbaa280a5e99ef8f013f25fe3a2b

View File

@@ -1 +1 @@
b1d7e104e034655fe41bc55c562d91e8074a2973d538b8b29301458db45afc57 5ef64b0f55d952c7b0016055eaf6bbc1b5b7afc09a62ee8e5e694ffa9863ac7c

View File

@@ -5343,7 +5343,6 @@ static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){
int i; int i;
int regHit = 0; int regHit = 0;
int addrHitTest = 0; int addrHitTest = 0;
int bFilterMinMax = 0;
struct AggInfo_func *pF; struct AggInfo_func *pF;
struct AggInfo_col *pC; struct AggInfo_col *pC;
@@ -5360,12 +5359,14 @@ static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){
if( pAggInfo->nAccumulator if( pAggInfo->nAccumulator
&& (pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) && (pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)
){ ){
bFilterMinMax = 1;
if( regHit==0 ) regHit = ++pParse->nMem; if( regHit==0 ) regHit = ++pParse->nMem;
/* If this is the first row of the group (regAcc==0), clear the /* If this is the first row of the group (regAcc==0), clear the
** "magnet" register regHit so that the accumulator registers ** "magnet" register regHit so that the accumulator registers
** are populated even if the FILTER clause causes control to ** are populated if the FILTER clause jumps over the the
** skip over the invocation of min() or max() altogether */ ** invocation of min() or max() altogether. Or, if this is not
** the first row (regAcc==1), set the magnet register so that the
** accumulators are not populated unless the min()/max() is invoked and
** indicates that they should be. */
sqlite3VdbeAddOp2(v, OP_Copy, regAcc, regHit); sqlite3VdbeAddOp2(v, OP_Copy, regAcc, regHit);
} }
addrNext = sqlite3VdbeMakeLabel(pParse); addrNext = sqlite3VdbeMakeLabel(pParse);
@@ -5418,12 +5419,6 @@ static void updateAccumulator(Parse *pParse, int regAcc, AggInfo *pAggInfo){
for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){ for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
sqlite3ExprCode(pParse, pC->pExpr, pC->iMem); sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
} }
if( bFilterMinMax ){
/* If there is a min() or max() with a FILTER clause, then ensure that
** the "magnet" register is set to indicate "do not attract" after
** loading column values into the accumulator registers */
sqlite3VdbeAddOp2(v, OP_Integer, 1, regHit);
}
pAggInfo->directMode = 0; pAggInfo->directMode = 0;
if( addrHitTest ){ if( addrHitTest ){