1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Fix a bug in the lead() and lag() window functions causing them to fail when

used in queries featuring multiple window functions.

FossilOrigin-Name: 3839fb18f917e4f705821198d624b19d84eb07f1ee29ad23314ab7cec6bf6a2b
This commit is contained in:
dan
2018-06-15 16:10:44 +00:00
parent 303451a8f7
commit e0a5e20fa8
6 changed files with 109 additions and 13 deletions

View File

@@ -1108,7 +1108,7 @@ static void windowPartitionCache(
if( pMWin->pPartition ){
int addr;
ExprList *pPart = pMWin->pPartition;
int nPart = (pPart ? pPart->nExpr : 0);
int nPart = pPart->nExpr;
int regNewPart = reg + pMWin->nBufferCol;
KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0);
@@ -1175,7 +1175,7 @@ static void windowReturnOneRow(
}
else if( pFunc->xSFunc==leadStepFunc || pFunc->xSFunc==lagStepFunc ){
int nArg = pWin->pOwner->x.pList->nExpr;
int iEph = pWin->iEphCsr;
int iEph = pMWin->iEphCsr;
int csr = pWin->csrApp;
int lbl = sqlite3VdbeMakeLabel(v);
int tmpReg = sqlite3GetTempReg(pParse);