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

Make sure any window definitions in an ORDER BY clause are removed from

the SELECT statement if the ORDER BY clause gets optimized out.

FossilOrigin-Name: 23b119671f0be3c6b72cf2dc5f7707a0626766db7aa56529ab00d33d1a0a1bee
This commit is contained in:
drh
2019-07-20 21:12:31 +00:00
parent 7fc296aa66
commit fd15e18d7f
5 changed files with 46 additions and 20 deletions

View File

@@ -5661,6 +5661,7 @@ int sqlite3Select(
pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_Fifo);
/* If ORDER BY makes no difference in the output then neither does
** DISTINCT so it can be removed too. */
sqlite3WindowRemoveExprListFromSelect(p, p->pOrderBy);
sqlite3ExprListDelete(db, p->pOrderBy);
p->pOrderBy = 0;
p->selFlags &= ~SF_Distinct;