aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-11-07 17:48:21 +0000
committerdrh <drh@noemail.net>2015-11-07 17:48:21 +0000
commit6e7722669ec0080c1fec7d315460b77aecbd9e4f (patch)
tree49e35d43c3863527944dc4557ceeb1ab115f8006 /src/select.c
parent2476a6f2cb071b4ea17a99b1ddc05111cd1422f4 (diff)
downloadsqlite-6e7722669ec0080c1fec7d315460b77aecbd9e4f.tar.gz
sqlite-6e7722669ec0080c1fec7d315460b77aecbd9e4f.zip
Proposed fix for an infinite loop bug in the WITH clause semantic analysis
logic. FossilOrigin-Name: 028475cb17a4b50baf0e9aba9bd3403d0a5d03b0
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index 456271365..bd732e5bc 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4003,12 +4003,12 @@ static struct Cte *searchWith(
** statement with which it is associated.
*/
void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){
- assert( bFree==0 || pParse->pWith==0 );
+ assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) );
if( pWith ){
assert( pParse->pWith!=pWith );
pWith->pOuter = pParse->pWith;
pParse->pWith = pWith;
- pParse->bFreeWith = bFree;
+ if( bFree ) pParse->pWithToFree = pWith;
}
}
@@ -4101,6 +4101,7 @@ static int withExpand(
pSavedWith = pParse->pWith;
pParse->pWith = pWith;
sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);
+ pParse->pWith = pWith;
for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
pEList = pLeft->pEList;