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

When translating arguments of aggregate functions into references to

expression indexes, make sure to only translate them for the current
aggregate when there are nested aggregates.
[forum/forumpost/409ebc7368|Forum post 409ebc7368].

FossilOrigin-Name: 898bfa1afd8260eaaf2aa6db94e74d99ebf4e8a6dc02cf21d20cd981393609a5
This commit is contained in:
drh
2023-04-03 23:49:00 +00:00
parent f61bf3dbe8
commit 39b07f1afc
5 changed files with 32 additions and 12 deletions

View File

@@ -6485,7 +6485,7 @@ static int aggregateIdxEprRefToColCallback(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
pAggInfo = pExpr->pAggInfo;
if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue;
if( NEVER(pExpr->iAgg>=pAggInfo->nColumn) ) return WRC_Continue;
assert( pExpr->iAgg>=0 );
pCol = &pAggInfo->aCol[pExpr->iAgg];
pExpr->op = TK_AGG_COLUMN;