mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Do not attempt to flatten compound sub-queries in a FROM clause into the parent if any component of the sub-query uses a window function.
FossilOrigin-Name: eeb76f621de2f930a548db0fbb9fe25b4479b73581826b8dfa2e63cd1f1ab783
This commit is contained in:
@@ -3669,6 +3669,7 @@ static void substSelect(
|
||||
** (17d1) aggregate, or
|
||||
** (17d2) DISTINCT, or
|
||||
** (17d3) a join.
|
||||
** (17e) the subquery may not contain window functions
|
||||
**
|
||||
** The parent and sub-query may contain WHERE clauses. Subject to
|
||||
** rules (11), (13) and (14), they may also contain ORDER BY,
|
||||
@@ -3853,6 +3854,7 @@ static int flattenSubquery(
|
||||
if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
|
||||
|| (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
|
||||
|| pSub1->pSrc->nSrc<1 /* (17c) */
|
||||
|| pSub1->pWin /* (17d) */
|
||||
){
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user