1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Fix a problem with window functions occuring within sub-selects that are part of an OR term in a WHERE clause of the outer SELECT.

FossilOrigin-Name: 1e174ed0d29366eb56ad1a0cc8defcb440b426bfd9525aed2f93468248606efc
This commit is contained in:
dan
2020-02-29 17:19:42 +00:00
parent 4a3a3eb3d7
commit 0a21ea997d
4 changed files with 75 additions and 9 deletions

View File

@@ -1910,6 +1910,7 @@ static int windowInitAccum(Parse *pParse, Window *pMWin){
Window *pWin;
for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
FuncDef *pFunc = pWin->pFunc;
assert( pWin->regAccum );
sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
nArg = MAX(nArg, windowArgCount(pWin));
if( pMWin->regStartRowid==0 ){
@@ -2288,6 +2289,10 @@ Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p){
pNew->eStart = p->eStart;
pNew->eExclude = p->eExclude;
pNew->regResult = p->regResult;
pNew->regAccum = p->regAccum;
pNew->iArgCol = p->iArgCol;
pNew->iEphCsr = p->iEphCsr;
pNew->bExprArgs = p->bExprArgs;
pNew->pStart = sqlite3ExprDup(db, p->pStart, 0);
pNew->pEnd = sqlite3ExprDup(db, p->pEnd, 0);
pNew->pOwner = pOwner;