aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2019-12-27 08:57:08 +0000
committerdan <dan@noemail.net>2019-12-27 08:57:08 +0000
commit5e484cb3ebd8fe3f14df1ae07810625202e47a3a (patch)
treed91fc0ada8c3803d6522b22b747a1b2f15e7877c /src/expr.c
parentfce8165ec6e6e8faea57e0130cc84ecf104fb471 (diff)
downloadsqlite-5e484cb3ebd8fe3f14df1ae07810625202e47a3a.tar.gz
sqlite-5e484cb3ebd8fe3f14df1ae07810625202e47a3a.zip
When determining if an aggregate within a sub-query should be processed as part of the sub-query or an outer query, consider any FILTER clause in the same way as the arguments to the aggregate.
FossilOrigin-Name: 1ffc045d2bbeeda9c13a3a3585538ff6434fc852b0ae6679d3c8b9f606bf92e6
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 7901608d2..92786732f 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -5492,6 +5492,11 @@ int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){
cnt.nThis = 0;
cnt.nOther = 0;
sqlite3WalkExprList(&w, pExpr->x.pList);
+#ifndef SQLITE_OMIT_WINDOWFUNC
+ if( ExprHasProperty(pExpr, EP_WinFunc) ){
+ sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter);
+ }
+#endif
return cnt.nThis>0 || cnt.nOther==0;
}