aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-05-21 20:13:39 +0000
committerdrh <drh@noemail.net>2012-05-21 20:13:39 +0000
commit3a8c4be7d48378c132cc6145321b8cb31f11a7d8 (patch)
tree8eeed4b258e839fa5f74a02abce10e79a4881329 /src/expr.c
parenta51009b251eca47fae7ffa7a285bcd414b893d97 (diff)
downloadsqlite-3a8c4be7d48378c132cc6145321b8cb31f11a7d8.tar.gz
sqlite-3a8c4be7d48378c132cc6145321b8cb31f11a7d8.zip
Candidate fix for the nested aggregate query problem of ticket
[c2ad16f997ee9c8e]. FossilOrigin-Name: f3dd1fafd4718558de1f06139419a8c560d727f5
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index 10d9f775d..95c351586 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -3965,7 +3965,9 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
return WRC_Prune;
}
case TK_AGG_FUNCTION: {
- if( !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList) ){
+ if( (pNC->ncFlags & NC_InAggFunc)==0
+ && !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList)
+ ){
/* Check to see if pExpr is a duplicate of another aggregate
** function that is already in the pAggInfo structure
*/
@@ -4002,8 +4004,8 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
ExprSetIrreducible(pExpr);
pExpr->iAgg = (i16)i;
pExpr->pAggInfo = pAggInfo;
- return WRC_Prune;
}
+ return WRC_Prune;
}
}
return WRC_Continue;