aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/analyze.c b/src/analyze.c
index 2eaabd6be..9e0a0c5e6 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -1297,6 +1297,21 @@ static void analyzeOneTable(
/* Allocate space to compute results for the largest index */
pParse->nMem = MAX(pParse->nMem, regCol+mxCol);
doOnce = 0;
+#ifdef SQLITE_DEBUG
+ /* Verify that setting pParse->nTempReg to zero below really
+ ** is needed in some cases, in order to excise all temporary
+ ** registers from the middle of the STAT4 buffer.
+ ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
+ */
+ if( pParse->nTempReg>0 ){
+ int kk;
+ for(kk=0; kk<pParse->nTempReg; kk++){
+ int regT = pParse->aTempReg[kk];
+ testcase( regT>=regCol && regT<regCol+mxCol );
+ }
+ }
+#endif
+ pParse->nTempReg = 0;
}
addrNext = sqlite3VdbeCurrentAddr(v);