mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Ensure that objects within view definitions are not incorrectly resolved to CTEs that are part of the statement using the view.
FossilOrigin-Name: f7dcc4b5197c6413be31384b390bb98a737d3f9edb7964433448c3b90b35a436
This commit is contained in:
10
src/select.c
10
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
|
||||
|
||||
Reference in New Issue
Block a user