aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c
index 2b27eea63..26a3172ae 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4153,6 +4153,8 @@ static void renumberCursors(
** (27) The subquery may not contain a FULL or RIGHT JOIN unless it
** is the first element of the parent query.
**
+** (28) The subquery is not a MATERIALIZED CTE.
+**
**
** In this routine, the "p" parameter is a pointer to the outer query.
** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
@@ -4276,6 +4278,9 @@ static int flattenSubquery(
if( iFrom>0 && (pSubSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
return 0; /* Restriction (27) */
}
+ if( pSubitem->fg.isCte && pSubitem->u2.pCteUse->eM10d==M10d_Yes ){
+ return 0; /* (28) */
+ }
/* Restriction (17): If the sub-query is a compound SELECT, then it must
** use only the UNION ALL operator. And none of the simple select queries