1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Remove Window objects from the corresponding Select.pWin list when they are deleted.

FossilOrigin-Name: d23f33168222dfa40a67dc7de58057418151989e81429e4af47617e86db04667
This commit is contained in:
dan
2019-07-22 16:20:03 +00:00
parent fd15e18d7f
commit 75b0821e99
8 changed files with 70 additions and 53 deletions

View File

@@ -1326,10 +1326,17 @@ static With *withDup(sqlite3 *db, With *p){
*/
static int gatherSelectWindowsCallback(Walker *pWalker, Expr *pExpr){
if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_WinFunc) ){
assert( pExpr->y.pWin );
Select *pSelect = pWalker->u.pSelect;
Window *pWin = pExpr->y.pWin;
assert( pWin );
assert( IsWindowFunc(pExpr) );
pExpr->y.pWin->pNextWin = pWalker->u.pSelect->pWin;
pWalker->u.pSelect->pWin = pExpr->y.pWin;
if( pSelect->pWin ){
*pSelect->pWin->ppThis = pSelect->pWin->pNextWin;
pSelect->pWin->ppThis = &pWin->pNextWin;
}
pWin->pNextWin = pSelect->pWin;
pWin->ppThis = &pSelect->pWin;
pSelect->pWin = pWin;
}
return WRC_Continue;
}