aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/insert.c4
-rw-r--r--src/select.c6
-rw-r--r--src/tokenize.c2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/insert.c b/src/insert.c
index d4f404c0b..2f91cf474 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1004,7 +1004,9 @@ void sqlite3Insert(
pNx->iDataCur = iDataCur;
pNx->iIdxCur = iIdxCur;
if( pNx->pUpsertTarget ){
- sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx);
+ if( sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx) ){
+ goto insert_cleanup;
+ }
}
pNx = pNx->pNextUpsert;
}while( pNx!=0 );
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;
diff --git a/src/tokenize.c b/src/tokenize.c
index 712447c4c..5e01de2b9 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -80,7 +80,7 @@ static const unsigned char aiClass[] = {
#ifdef SQLITE_EBCDIC
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
/* 0x */ 29, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 7, 7, 28, 28,
-/* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+/* 1x */ 28, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 2x */ 28, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 3x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 4x */ 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 12, 17, 20, 10,