aboutsummaryrefslogtreecommitdiff
path: root/ext/fts5/fts5_index.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2023-11-23 11:18:06 +0000
committerdan <Dan Kennedy>2023-11-23 11:18:06 +0000
commit226aebae0741f08130a4faad61d3e7dbebd2893c (patch)
tree6732e006853585158159b439aa8ca5b21fcfc8af /ext/fts5/fts5_index.c
parent5d175eb0206a16b2062482c9ec41c1203a7cf394 (diff)
downloadsqlite-226aebae0741f08130a4faad61d3e7dbebd2893c.tar.gz
sqlite-226aebae0741f08130a4faad61d3e7dbebd2893c.zip
Fix an fts5 problem that could occur when mixing regular and secure delete operations on a single table.
FossilOrigin-Name: 8eb3f40021994f0d25ef9d246873796c84886e5951bb8ab991e1e2df31998484
Diffstat (limited to 'ext/fts5/fts5_index.c')
-rw-r--r--ext/fts5/fts5_index.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ext/fts5/fts5_index.c b/ext/fts5/fts5_index.c
index ba3ce6536..c467addb8 100644
--- a/ext/fts5/fts5_index.c
+++ b/ext/fts5/fts5_index.c
@@ -5137,18 +5137,24 @@ static void fts5DoSecureDelete(
iOff = iStart;
- /* Set variable bLastInDoclist to true if this entry happens to be
- ** the last rowid in the doclist for its term. */
+ /* If the position-list for the entry being removed flows over past
+ ** the end of this page, delete the portion of the position-list on the
+ ** next page and beyond.
+ **
+ ** Set variable bLastInDoclist to true if this entry happens
+ ** to be the last rowid in the doclist for its term. */
+ if( iNextOff>=iPgIdx ){
+ int pgno = pSeg->iLeafPgno+1;
+ fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
+ iNextOff = iPgIdx;
+ }
+
if( pSeg->bDel==0 ){
- if( iNextOff>=iPgIdx ){
- int pgno = pSeg->iLeafPgno+1;
- fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist);
- iNextOff = iPgIdx;
- }else{
+ if( iNextOff!=iPgIdx ){
/* Loop through the page-footer. If iNextOff (offset of the
** entry following the one we are removing) is equal to the
** offset of a key on this page, then the entry is the last
- ** in its doclist. */
+ ** in its doclist. */
int iKeyOff = 0;
for(iIdx=0; iIdx<nIdx; /* no-op */){
u32 iVal = 0;