diff options
author | dan <Dan Kennedy> | 2021-05-20 17:15:06 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2021-05-20 17:15:06 +0000 |
commit | 90bc36fb30cc7f875a623f876b58351cc23a4490 (patch) | |
tree | a6e52052d6ff49379272a9662213aef12d72388e /src/select.c | |
parent | a8f249f1e7d284495683b3e74c0fb3bf9a1acb50 (diff) | |
download | sqlite-90bc36fb30cc7f875a623f876b58351cc23a4490.tar.gz sqlite-90bc36fb30cc7f875a623f876b58351cc23a4490.zip |
Ensure that objects within view definitions are not incorrectly resolved to CTEs that are part of the statement using the view.
FossilOrigin-Name: f7dcc4b5197c6413be31384b390bb98a737d3f9edb7964433448c3b90b35a436
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 10 |
1 files changed, 10 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 |