diff options
author | drh <> | 2021-03-19 19:09:24 +0000 |
---|---|---|
committer | drh <> | 2021-03-19 19:09:24 +0000 |
commit | d218decec500b362eb814193451369243b473f12 (patch) | |
tree | 0f81c9bdded0e8d5359c8c3c3dcaf2aed8ba4681 /src/select.c | |
parent | a979993b25266d6a0f8a91ed36cf817162e86700 (diff) | |
parent | 49e6e5a04fe0d9f3d3ec4df4d53751225b8161c0 (diff) | |
download | sqlite-d218decec500b362eb814193451369243b473f12.tar.gz sqlite-d218decec500b362eb814193451369243b473f12.zip |
Merge enhancements from trunk.
FossilOrigin-Name: d192d737755876293a2914fcb9a0d5efbe07f3cd281c038666ea5aa879c06321
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c index d172e2da7..3dd944d9c 100644 --- a/src/select.c +++ b/src/select.c @@ -6386,7 +6386,9 @@ int sqlite3Select( sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor); pSub->nSelectRow = pPrior->pSelect->nSelectRow; }else{ - /* Generate a subroutine that will materialize the view. */ + /* Materalize the view. If the view is not correlated, generate a + ** subroutine to do the materialization so that subsequent uses of + ** the same view can reuse the materialization. */ int topAddr; int onceAddr = 0; int retAddr; @@ -6413,7 +6415,7 @@ int sqlite3Select( VdbeComment((v, "end %!S", pItem)); sqlite3VdbeChangeP1(v, topAddr, retAddr); sqlite3ClearTempRegCache(pParse); - if( pItem->fg.isCte ){ + if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){ CteUse *pCteUse = pItem->u2.pCteUse; pCteUse->addrM9e = pItem->addrFillSub; pCteUse->regRtn = pItem->regReturn; |