mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix a problem causing the count(*) optimization to be misapplied in some cases where an aggregate sub-query uses a count() expression that is aggregated against the outer query.
FossilOrigin-Name: e30917278c0ec750b1756ddc5e32d65c55464531d6ef64d2e72a412dfe634f58
This commit is contained in:
@@ -4980,6 +4980,7 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
|
||||
pExpr = p->pEList->a[0].pExpr;
|
||||
assert( pExpr!=0 );
|
||||
if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
|
||||
if( pExpr->pAggInfo!=pAggInfo ) return 0;
|
||||
if( (pAggInfo->aFunc[0].pFunc->funcFlags&SQLITE_FUNC_COUNT)==0 ) return 0;
|
||||
assert( pAggInfo->aFunc[0].pFExpr==pExpr );
|
||||
testcase( ExprHasProperty(pExpr, EP_Distinct) );
|
||||
|
||||
Reference in New Issue
Block a user