diff options
author | drh <drh@noemail.net> | 2011-12-07 01:55:51 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-12-07 01:55:51 +0000 |
commit | 23b1b37229b8f28c70d3711228ef58cb7a370b0b (patch) | |
tree | 85bbd232ccd3444254358421bb15651ef43c5396 /src/expr.c | |
parent | ed51f29774ca0581de17d7f4a066fea1b0459948 (diff) | |
download | sqlite-23b1b37229b8f28c70d3711228ef58cb7a370b0b.tar.gz sqlite-23b1b37229b8f28c70d3711228ef58cb7a370b0b.zip |
Cherrypick the [7e5b56b1c6] fix for the sqlite3SelectDup() routine
into trunk.
FossilOrigin-Name: 7fc535090ca3416706dff4abce10ac2d7f775e02
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index e8a9d6410..136f302f9 100644 --- a/src/expr.c +++ b/src/expr.c @@ -940,7 +940,7 @@ IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){ return pNew; } Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ - Select *pNew; + Select *pNew, *pPrior; if( p==0 ) return 0; pNew = sqlite3DbMallocRaw(db, sizeof(*p) ); if( pNew==0 ) return 0; @@ -951,7 +951,9 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags); pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags); pNew->op = p->op; - pNew->pPrior = sqlite3SelectDup(db, p->pPrior, flags); + pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags); + if( pPrior ) pPrior->pNext = pNew; + pNew->pNext = 0; pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags); pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags); pNew->iLimit = 0; |