Fix a problem causing spurious "<cte>: circular reference" errors to be reported when there is actually a different error in the SQL statement.

FossilOrigin-Name: 9981223618782bf867dfc8988d0c634a42f569228880c5c5e00aa4ae762cfff2
This commit is contained in:
dan
2021-03-18 18:25:43 +00:00
parent 42d2aec1e9
commit ca237a8b7b
4 changed files with 36 additions and 11 deletions
+10 -2
View File
@@ -5060,16 +5060,24 @@ static int resolveFromTermToCte(
pSavedWith = pParse->pWith;
pParse->pWith = pWith;
if( pSel->selFlags & SF_Recursive ){
int rc;
assert( pRecTerm!=0 );
assert( (pRecTerm->selFlags & SF_Recursive)==0 );
assert( pRecTerm->pNext!=0 );
assert( (pRecTerm->pNext->selFlags & SF_Recursive)!=0 );
assert( pRecTerm->pWith==0 );
pRecTerm->pWith = pSel->pWith;
sqlite3WalkSelect(pWalker, pRecTerm);
rc = sqlite3WalkSelect(pWalker, pRecTerm);
pRecTerm->pWith = 0;
if( rc ){
pParse->pWith = pSavedWith;
return 2;
}
}else{
sqlite3WalkSelect(pWalker, pSel);
if( sqlite3WalkSelect(pWalker, pSel) ){
pParse->pWith = pSavedWith;
return 2;
}
}
pParse->pWith = pWith;