mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Disable the flattening optimization if the sub-query is a recursive CTE.
FossilOrigin-Name: 9472f6d820a7fb233936d9b8f7a39c9d4c4d6d73
This commit is contained in:
@@ -2844,6 +2844,8 @@ static void substSelect(
|
||||
**
|
||||
** Flattening is only attempted if all of the following are true:
|
||||
**
|
||||
** (0) The subquery is not a recursive CTE.
|
||||
**
|
||||
** (1) The subquery and the outer query do not both use aggregates.
|
||||
**
|
||||
** (2) The subquery is not an aggregate or the outer query is not a join.
|
||||
@@ -2968,6 +2970,7 @@ static int flattenSubquery(
|
||||
iParent = pSubitem->iCursor;
|
||||
pSub = pSubitem->pSelect;
|
||||
assert( pSub!=0 );
|
||||
if( pSub->pRecurse ) return 0; /* Restriction (0) */
|
||||
if( isAgg && subqueryIsAgg ) return 0; /* Restriction (1) */
|
||||
if( subqueryIsAgg && pSrc->nSrc>1 ) return 0; /* Restriction (2) */
|
||||
pSubSrc = pSub->pSrc;
|
||||
|
||||
Reference in New Issue
Block a user