1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Further improvements to the processing of nested aggregate queries.

FossilOrigin-Name: 3c3ffa901f5ce8a523028ff15563ce3e0f55a641
This commit is contained in:
drh
2012-08-23 16:18:10 +00:00
parent 2f7d5d8394
commit 030796df8d
7 changed files with 124 additions and 34 deletions

View File

@@ -568,13 +568,19 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
nId, zId);
pNC->nErr++;
}
if( is_agg ){
pExpr->op = TK_AGG_FUNCTION;
pNC->ncFlags |= NC_HasAgg;
}
if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;
sqlite3WalkExprList(pWalker, pList);
if( is_agg ) pNC->ncFlags |= NC_AllowAgg;
if( is_agg ){
NameContext *pNC2 = pNC;
pExpr->op = TK_AGG_FUNCTION;
pExpr->op2 = 0;
while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){
pExpr->op2++;
pNC2 = pNC2->pNext;
}
if( pNC2 ) pNC2->ncFlags |= NC_HasAgg;
pNC->ncFlags |= NC_AllowAgg;
}
/* FIX ME: Compute pExpr->affinity based on the expected return
** type of the function
*/