diff options
author | drh <> | 2023-03-25 18:31:24 +0000 |
---|---|---|
committer | drh <> | 2023-03-25 18:31:24 +0000 |
commit | 4924e828637f42b79c792bc843e1970641200c61 (patch) | |
tree | f954763d71edd5f8bdf0b0a1052b84730b33b552 /src | |
parent | e5895333dde929c9be1baa88ffda7b3471754c04 (diff) | |
download | sqlite-4924e828637f42b79c792bc843e1970641200c61.tar.gz sqlite-4924e828637f42b79c792bc843e1970641200c61.zip |
The fix at [2bf5413dc2c19d5f] was incomplete in that it failed to clear
the reusable register cache that might contain registers in the STAT4
buffer region. This additional change corrects the problem.
[forum:/forumpost/83cb4a95a0|Forum post 83cb4a95a0]. Test case in TH3.
FossilOrigin-Name: 5d554e4d0f59a4309fed40e4fb26c7be42f1d4d55ccdcaaf7b4d445aa3122955
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze.c | 15 |
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); |