diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 10 | ||||
-rw-r--r-- | src/sqliteInt.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/select.c b/src/select.c index 1ac25c5de..88aa79527 100644 --- a/src/select.c +++ b/src/select.c @@ -5011,6 +5011,7 @@ static struct Cte *searchWith( return &p->a[i]; } } + if( p->bView ) break; } return 0; } @@ -5323,6 +5324,15 @@ static int selectExpander(Walker *pWalker, Select *p){ } pTabList = p->pSrc; pEList = p->pEList; + if( pParse->pWith && (p->selFlags & SF_View) ){ + if( p->pWith==0 ){ + p->pWith = (With*)sqlite3DbMallocZero(db, sizeof(With)); + if( p->pWith==0 ){ + return WRC_Abort; + } + } + p->pWith->bView = 1; + } sqlite3WithPush(pParse, p->pWith, 0); /* Make sure cursor numbers have been assigned to all entries in diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1bdccddec..6fa33ea55 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3926,6 +3926,7 @@ struct Cte { */ struct With { int nCte; /* Number of CTEs in the WITH clause */ + int bView; /* Belongs to the outermost Select of a view */ With *pOuter; /* Containing WITH clause, or NULL */ Cte a[1]; /* For each CTE in the WITH clause.... */ }; |