1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Fix problems with ALTER TABLE and schemas that contain views with some recursive CTEs, or CTEs that reference other CTEs.

FossilOrigin-Name: 8b1f9a51e962cd9a5593a1ecf4da6c86e34c4f9ff96ffcea0fb421880c8836cb
This commit is contained in:
dan
2021-06-11 11:14:24 +00:00
parent 75016050f3
commit 26d61e5adf
6 changed files with 167 additions and 21 deletions

View File

@@ -1413,7 +1413,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){
** and the db->mallocFailed flag set.
*/
#ifndef SQLITE_OMIT_CTE
static With *withDup(sqlite3 *db, With *p){
With *sqlite3WithDup(sqlite3 *db, With *p){
With *pRet = 0;
if( p ){
sqlite3_int64 nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1);
@@ -1431,7 +1431,7 @@ static With *withDup(sqlite3 *db, With *p){
return pRet;
}
#else
# define withDup(x,y) 0
# define sqlite3WithDup(x,y) 0
#endif
#ifndef SQLITE_OMIT_WINDOWFUNC
@@ -1635,7 +1635,7 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){
pNew->addrOpenEphm[0] = -1;
pNew->addrOpenEphm[1] = -1;
pNew->nSelectRow = p->nSelectRow;
pNew->pWith = withDup(db, p->pWith);
pNew->pWith = sqlite3WithDup(db, p->pWith);
#ifndef SQLITE_OMIT_WINDOWFUNC
pNew->pWin = 0;
pNew->pWinDefn = sqlite3WindowListDup(db, p->pWinDefn);