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

Avoid redundant ORDER BY operations when rewriting SELECT statements that

contain window functions.

FossilOrigin-Name: 336de43a47e206fe7629072e5b8c80d4ede17ead8ef4dcf5d8da6833ff22d2f9
This commit is contained in:
dan
2018-06-27 19:48:50 +00:00
parent c994b0225b
commit f02cdd379a
4 changed files with 27 additions and 19 deletions

View File

@@ -5484,8 +5484,6 @@ int sqlite3Select(
p->selFlags &= ~SF_Distinct;
}
sqlite3SelectPrep(pParse, p, 0);
memset(&sSort, 0, sizeof(sSort));
sSort.pOrderBy = p->pOrderBy;
if( pParse->nErr || db->mallocFailed ){
goto select_end;
}
@@ -5514,6 +5512,8 @@ int sqlite3Select(
#endif /* SQLITE_OMIT_WINDOWFUNC */
pTabList = p->pSrc;
isAgg = (p->selFlags & SF_Aggregate)!=0;
memset(&sSort, 0, sizeof(sSort));
sSort.pOrderBy = p->pOrderBy;
/* Try to various optimizations (flattening subqueries, and strength
** reduction of join operators) in the FROM clause up into the main query