Fossil SCM

Update the built-in SQLite to the latest trunk version, for testing.

drh 2026-06-08 19:29 UTC trunk
Commit a570ebc608437016f1526ebb51b10eb0dd7abd9bace7a0298e2d976b07fc281b
+16 -9
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -12699,10 +12699,11 @@
1269912699
1270012700
for(p=pCsr->pFreeEntry; p; p=pNext){
1270112701
pNext = p->pNext;
1270212702
zipfileEntryFree(p);
1270312703
}
12704
+ pCsr->pFreeEntry = 0;
1270412705
}
1270512706
1270612707
/*
1270712708
** Destructor for an ZipfileCsr.
1270812709
*/
@@ -13101,11 +13102,17 @@
1310113102
}
1310213103
}
1310313104
1310413105
if( rc==SQLITE_OK ){
1310513106
u32 *pt = &pNew->mUnixTime;
13106
- pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead);
13107
+ /* aRead[0..nFile-1] might contain embedded \000 characters
13108
+ ** See Bug 2026-05-31T11:43:05Z */
13109
+ pNew->cds.zFile = sqlite3_malloc64(nFile+1);
13110
+ if( pNew->cds.zFile!=0 ){
13111
+ memcpy(pNew->cds.zFile, aRead, nFile);
13112
+ pNew->cds.zFile[nFile] = 0;
13113
+ }
1310713114
pNew->aExtra = (u8*)&pNew[1];
1310813115
memcpy(pNew->aExtra, &aRead[nFile], nExtra);
1310913116
if( pNew->cds.zFile==0 ){
1311013117
rc = SQLITE_NOMEM;
1311113118
}else if( 0==zipfileScanExtra(&aRead[nFile], pNew->cds.nExtra, pt) ){
@@ -14205,14 +14212,14 @@
1420514212
ZipfileBuffer body;
1420614213
ZipfileBuffer cds;
1420714214
};
1420814215
1420914216
static int zipfileBufferGrow(ZipfileBuffer *pBuf, i64 nByte){
14210
- if( pBuf->n+nByte>pBuf->nAlloc ){
14217
+ if( (pBuf->nAlloc-pBuf->n)<nByte ){
1421114218
u8 *aNew;
14212
- sqlite3_int64 nNew = pBuf->n ? pBuf->n*2 : 512;
14213
- int nReq = pBuf->n + nByte;
14219
+ i64 nNew = pBuf->n ? (i64)pBuf->n*2 : 512;
14220
+ i64 nReq = pBuf->n + nByte;
1421414221
1421514222
while( nNew<nReq ) nNew = nNew*2;
1421614223
aNew = sqlite3_realloc64(pBuf->a, nNew);
1421714224
if( aNew==0 ) return SQLITE_NOMEM;
1421814225
pBuf->a = aNew;
@@ -16310,11 +16317,11 @@
1631016317
p->pTable = pTab;
1631116318
1631216319
/* The statement the vtab will pass to sqlite3_declare_vtab() */
1631316320
zInner = idxAppendText(&rc, 0, "CREATE TABLE x(");
1631416321
for(i=0; i<pTab->nCol; i++){
16315
- zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %s",
16322
+ zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %Q",
1631616323
(i==0 ? "" : ", "), pTab->aCol[i].zName, pTab->aCol[i].zColl
1631716324
);
1631816325
}
1631916326
zInner = idxAppendText(&rc, zInner, ")");
1632016327
@@ -16510,11 +16517,11 @@
1651016517
sqlite3_free(zCols);
1651116518
sqlite3_free(zOrder);
1651216519
return sqlite3_reset(pIndexXInfo);
1651316520
}
1651416521
zCols = idxAppendText(&rc, zCols,
16515
- "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s",
16522
+ "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %Q",
1651616523
zComma, zName, nCol, zName, zColl
1651716524
);
1651816525
zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
1651916526
}
1652016527
sqlite3_reset(pIndexXInfo);
@@ -25163,11 +25170,11 @@
2516325170
/*
2516425171
** Return true if either the SQLITE_NO_COLOR compile-time option is used
2516525172
** or if the NO_COLOR environment variable exists
2516625173
*/
2516725174
static int shellNoColor(void){
25168
-#ifdef SQLITE_NO_COLOR
25175
+#if defined(SQLITE_NO_COLOR) || defined(SQLITE_SHELL_FIDDLE)
2516925176
return 1;
2517025177
#else
2517125178
return getenv("NO_COLOR")!=0;
2517225179
#endif
2517325180
}
@@ -32327,11 +32334,11 @@
3232732334
;
3232832335
static const char * const zCollectVar = "\
3232932336
SELECT\
3233032337
'('||x'0a'\
3233132338
|| group_concat(\
32332
- cname||' ANY',\
32339
+ cname,\
3233332340
','||iif((cpos-1)%4>0, ' ', x'0a'||' '))\
3233432341
||')' AS ColsSpec \
3233532342
FROM (\
3233632343
SELECT cpos, printf('\"%w\"',printf('%!.*s%s', nlen-chop,name,suff)) AS cname \
3233732344
FROM ColNames ORDER BY cpos\
@@ -37939,11 +37946,11 @@
3793937946
}
3794037947
3794137948
/*
3794237949
** The callback from atexit().
3794337950
*/
37944
-static void abnormalExit(void){
37951
+static void SQLITE_CDECL abnormalExit(void){
3794537952
if( seenInterrupt ) eputz("Program interrupted.\n");
3794637953
if( globalShellState ){
3794737954
clearTempFile(globalShellState, 1, 1);
3794837955
}
3794937956
}
3795037957
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -12699,10 +12699,11 @@
12699
12700 for(p=pCsr->pFreeEntry; p; p=pNext){
12701 pNext = p->pNext;
12702 zipfileEntryFree(p);
12703 }
 
12704 }
12705
12706 /*
12707 ** Destructor for an ZipfileCsr.
12708 */
@@ -13101,11 +13102,17 @@
13101 }
13102 }
13103
13104 if( rc==SQLITE_OK ){
13105 u32 *pt = &pNew->mUnixTime;
13106 pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead);
 
 
 
 
 
 
13107 pNew->aExtra = (u8*)&pNew[1];
13108 memcpy(pNew->aExtra, &aRead[nFile], nExtra);
13109 if( pNew->cds.zFile==0 ){
13110 rc = SQLITE_NOMEM;
13111 }else if( 0==zipfileScanExtra(&aRead[nFile], pNew->cds.nExtra, pt) ){
@@ -14205,14 +14212,14 @@
14205 ZipfileBuffer body;
14206 ZipfileBuffer cds;
14207 };
14208
14209 static int zipfileBufferGrow(ZipfileBuffer *pBuf, i64 nByte){
14210 if( pBuf->n+nByte>pBuf->nAlloc ){
14211 u8 *aNew;
14212 sqlite3_int64 nNew = pBuf->n ? pBuf->n*2 : 512;
14213 int nReq = pBuf->n + nByte;
14214
14215 while( nNew<nReq ) nNew = nNew*2;
14216 aNew = sqlite3_realloc64(pBuf->a, nNew);
14217 if( aNew==0 ) return SQLITE_NOMEM;
14218 pBuf->a = aNew;
@@ -16310,11 +16317,11 @@
16310 p->pTable = pTab;
16311
16312 /* The statement the vtab will pass to sqlite3_declare_vtab() */
16313 zInner = idxAppendText(&rc, 0, "CREATE TABLE x(");
16314 for(i=0; i<pTab->nCol; i++){
16315 zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %s",
16316 (i==0 ? "" : ", "), pTab->aCol[i].zName, pTab->aCol[i].zColl
16317 );
16318 }
16319 zInner = idxAppendText(&rc, zInner, ")");
16320
@@ -16510,11 +16517,11 @@
16510 sqlite3_free(zCols);
16511 sqlite3_free(zOrder);
16512 return sqlite3_reset(pIndexXInfo);
16513 }
16514 zCols = idxAppendText(&rc, zCols,
16515 "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %s",
16516 zComma, zName, nCol, zName, zColl
16517 );
16518 zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
16519 }
16520 sqlite3_reset(pIndexXInfo);
@@ -25163,11 +25170,11 @@
25163 /*
25164 ** Return true if either the SQLITE_NO_COLOR compile-time option is used
25165 ** or if the NO_COLOR environment variable exists
25166 */
25167 static int shellNoColor(void){
25168 #ifdef SQLITE_NO_COLOR
25169 return 1;
25170 #else
25171 return getenv("NO_COLOR")!=0;
25172 #endif
25173 }
@@ -32327,11 +32334,11 @@
32327 ;
32328 static const char * const zCollectVar = "\
32329 SELECT\
32330 '('||x'0a'\
32331 || group_concat(\
32332 cname||' ANY',\
32333 ','||iif((cpos-1)%4>0, ' ', x'0a'||' '))\
32334 ||')' AS ColsSpec \
32335 FROM (\
32336 SELECT cpos, printf('\"%w\"',printf('%!.*s%s', nlen-chop,name,suff)) AS cname \
32337 FROM ColNames ORDER BY cpos\
@@ -37939,11 +37946,11 @@
37939 }
37940
37941 /*
37942 ** The callback from atexit().
37943 */
37944 static void abnormalExit(void){
37945 if( seenInterrupt ) eputz("Program interrupted.\n");
37946 if( globalShellState ){
37947 clearTempFile(globalShellState, 1, 1);
37948 }
37949 }
37950
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -12699,10 +12699,11 @@
12699
12700 for(p=pCsr->pFreeEntry; p; p=pNext){
12701 pNext = p->pNext;
12702 zipfileEntryFree(p);
12703 }
12704 pCsr->pFreeEntry = 0;
12705 }
12706
12707 /*
12708 ** Destructor for an ZipfileCsr.
12709 */
@@ -13101,11 +13102,17 @@
13102 }
13103 }
13104
13105 if( rc==SQLITE_OK ){
13106 u32 *pt = &pNew->mUnixTime;
13107 /* aRead[0..nFile-1] might contain embedded \000 characters
13108 ** See Bug 2026-05-31T11:43:05Z */
13109 pNew->cds.zFile = sqlite3_malloc64(nFile+1);
13110 if( pNew->cds.zFile!=0 ){
13111 memcpy(pNew->cds.zFile, aRead, nFile);
13112 pNew->cds.zFile[nFile] = 0;
13113 }
13114 pNew->aExtra = (u8*)&pNew[1];
13115 memcpy(pNew->aExtra, &aRead[nFile], nExtra);
13116 if( pNew->cds.zFile==0 ){
13117 rc = SQLITE_NOMEM;
13118 }else if( 0==zipfileScanExtra(&aRead[nFile], pNew->cds.nExtra, pt) ){
@@ -14205,14 +14212,14 @@
14212 ZipfileBuffer body;
14213 ZipfileBuffer cds;
14214 };
14215
14216 static int zipfileBufferGrow(ZipfileBuffer *pBuf, i64 nByte){
14217 if( (pBuf->nAlloc-pBuf->n)<nByte ){
14218 u8 *aNew;
14219 i64 nNew = pBuf->n ? (i64)pBuf->n*2 : 512;
14220 i64 nReq = pBuf->n + nByte;
14221
14222 while( nNew<nReq ) nNew = nNew*2;
14223 aNew = sqlite3_realloc64(pBuf->a, nNew);
14224 if( aNew==0 ) return SQLITE_NOMEM;
14225 pBuf->a = aNew;
@@ -16310,11 +16317,11 @@
16317 p->pTable = pTab;
16318
16319 /* The statement the vtab will pass to sqlite3_declare_vtab() */
16320 zInner = idxAppendText(&rc, 0, "CREATE TABLE x(");
16321 for(i=0; i<pTab->nCol; i++){
16322 zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %Q",
16323 (i==0 ? "" : ", "), pTab->aCol[i].zName, pTab->aCol[i].zColl
16324 );
16325 }
16326 zInner = idxAppendText(&rc, zInner, ")");
16327
@@ -16510,11 +16517,11 @@
16517 sqlite3_free(zCols);
16518 sqlite3_free(zOrder);
16519 return sqlite3_reset(pIndexXInfo);
16520 }
16521 zCols = idxAppendText(&rc, zCols,
16522 "%sx.%Q IS sqlite_expert_rem(%d, x.%Q) COLLATE %Q",
16523 zComma, zName, nCol, zName, zColl
16524 );
16525 zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol);
16526 }
16527 sqlite3_reset(pIndexXInfo);
@@ -25163,11 +25170,11 @@
25170 /*
25171 ** Return true if either the SQLITE_NO_COLOR compile-time option is used
25172 ** or if the NO_COLOR environment variable exists
25173 */
25174 static int shellNoColor(void){
25175 #if defined(SQLITE_NO_COLOR) || defined(SQLITE_SHELL_FIDDLE)
25176 return 1;
25177 #else
25178 return getenv("NO_COLOR")!=0;
25179 #endif
25180 }
@@ -32327,11 +32334,11 @@
32334 ;
32335 static const char * const zCollectVar = "\
32336 SELECT\
32337 '('||x'0a'\
32338 || group_concat(\
32339 cname,\
32340 ','||iif((cpos-1)%4>0, ' ', x'0a'||' '))\
32341 ||')' AS ColsSpec \
32342 FROM (\
32343 SELECT cpos, printf('\"%w\"',printf('%!.*s%s', nlen-chop,name,suff)) AS cname \
32344 FROM ColNames ORDER BY cpos\
@@ -37939,11 +37946,11 @@
37946 }
37947
37948 /*
37949 ** The callback from atexit().
37950 */
37951 static void SQLITE_CDECL abnormalExit(void){
37952 if( seenInterrupt ) eputz("Program interrupted.\n");
37953 if( globalShellState ){
37954 clearTempFile(globalShellState, 1, 1);
37955 }
37956 }
37957
+162 -90
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** 2c605bfb1562d7a3609ad6ffd7446def12f1 with changes in files:
21
+** 4cb349370daab17123770c814c71872a3e4c with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467467
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468468
** [sqlite_version()] and [sqlite_source_id()].
469469
*/
470470
#define SQLITE_VERSION "3.54.0"
471471
#define SQLITE_VERSION_NUMBER 3054000
472
-#define SQLITE_SOURCE_ID "2026-05-30 13:23:25 2c605bfb1562d7a3609ad6ffd7446def12f1ac7084e41b9c6723e998c156501d"
472
+#define SQLITE_SOURCE_ID "2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2026-05-30T13:23:25.636Z"
475
+#define SQLITE_SCM_DATETIME "2026-06-08T18:15:27.790Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -33389,12 +33389,12 @@
3338933389
if( flag_alternateform ){
3339033390
/* For %#q, do unistr()-style backslash escapes for
3339133391
** all control characters, and for backslash itself.
3339233392
** For %#Q, do the same but only if there is at least
3339333393
** one control character. */
33394
- u32 nBack = 0;
33395
- u32 nCtrl = 0;
33394
+ i64 nBack = 0;
33395
+ i64 nCtrl = 0;
3339633396
for(k=0; k<i; k++){
3339733397
if( escarg[k]=='\\' ){
3339833398
nBack++;
3339933399
}else if( ((u8*)escarg)[k]<=0x1f ){
3340033400
nCtrl++;
@@ -56926,26 +56926,28 @@
5692656926
szBulk = -1024 * (i64)pcache1.nInitPage;
5692756927
}
5692856928
if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
5692956929
szBulk = pCache->szAlloc*(i64)pCache->nMax;
5693056930
}
56931
- zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
56932
- sqlite3EndBenignMalloc();
56933
- if( zBulk ){
56934
- int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
56935
- do{
56936
- PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
56937
- pX->page.pBuf = zBulk;
56938
- pX->page.pExtra = (u8*)pX + ROUND8(sizeof(*pX));
56939
- assert( EIGHT_BYTE_ALIGNMENT( pX->page.pExtra ) );
56940
- pX->isBulkLocal = 1;
56941
- pX->isAnchor = 0;
56942
- pX->pNext = pCache->pFree;
56943
- pX->pLruPrev = 0; /* Initializing this saves a valgrind error */
56944
- pCache->pFree = pX;
56945
- zBulk += pCache->szAlloc;
56946
- }while( --nBulk );
56931
+ if( szBulk>=pCache->szAlloc ){
56932
+ zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
56933
+ sqlite3EndBenignMalloc();
56934
+ if( zBulk ){
56935
+ int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
56936
+ do{
56937
+ PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
56938
+ pX->page.pBuf = zBulk;
56939
+ pX->page.pExtra = (u8*)pX + ROUND8(sizeof(*pX));
56940
+ assert( EIGHT_BYTE_ALIGNMENT( pX->page.pExtra ) );
56941
+ pX->isBulkLocal = 1;
56942
+ pX->isAnchor = 0;
56943
+ pX->pNext = pCache->pFree;
56944
+ pX->pLruPrev = 0; /* Initializing this saves a valgrind error */
56945
+ pCache->pFree = pX;
56946
+ zBulk += pCache->szAlloc;
56947
+ }while( --nBulk );
56948
+ }
5694756949
}
5694856950
return pCache->pFree!=0;
5694956951
}
5695056952
5695156953
/*
@@ -83086,10 +83088,15 @@
8308683088
if( pc+info.nSize>usableSize ){
8308783089
checkAppendMsg(pCheck, "Extends off end of page");
8308883090
doCoverageCheck = 0;
8308983091
continue;
8309083092
}
83093
+ if( info.nPayload && info.pPayload[0]<2 ){
83094
+ checkAppendMsg(pCheck, "Bad cell header size");
83095
+ doCoverageCheck = 0;
83096
+ continue;
83097
+ }
8309183098
8309283099
/* Check for integer primary key out of range */
8309383100
if( pPage->intKey ){
8309483101
if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
8309583102
checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
@@ -84596,12 +84603,12 @@
8459684603
/* Work-around for GCC bug or bugs:
8459784604
** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270
8459884605
** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659
8459984606
** The problem appears to be fixed in GCC 15 */
8460084607
i64 x;
84601
- assert( (MEM_Str&~p->flags)*4==sizeof(x) );
84602
- memcpy(&x, (char*)&p->u, (MEM_Str&~p->flags)*4);
84608
+ assert( (sqlite3Config.bSmallMalloc!=0xee)*8==sizeof(x) );
84609
+ memcpy(&x, (char*)&p->u.i, (sqlite3Config.bSmallMalloc!=0xee)*8);
8460384610
p->n = sqlite3Int64ToText(x, zBuf);
8460484611
#else
8460584612
p->n = sqlite3Int64ToText(p->u.i, zBuf);
8460684613
#endif
8460784614
if( p->flags & MEM_IntReal ){
@@ -95448,11 +95455,11 @@
9544895455
QueryPerformanceCounter(&tm);
9544995456
return (sqlite3_uint64)tm.QuadPart;
9545095457
}
9545195458
9545295459
#elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && \
95453
- (defined(i386) || defined(__i386__) || defined(_M_IX86))
95460
+ (defined(i586) || defined(__i586__) || defined(_M_IX86))
9545495461
9545595462
__inline__ sqlite_uint64 sqlite3Hwtime(void){
9545695463
unsigned int lo, hi;
9545795464
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
9545895465
return (sqlite_uint64)hi << 32 | lo;
@@ -110164,11 +110171,11 @@
110164110171
/*
110165110172
** cnt==0 means there was not match.
110166110173
** cnt>1 means there were two or more matches.
110167110174
**
110168110175
** cnt==0 is always an error. cnt>1 is often an error, but might
110169
- ** be multiple matches for a NATURAL LEFT JOIN or a LEFT JOIN USING.
110176
+ ** be multiple matches for a NATURAL OUTER JOIN or a OUTER JOIN USING.
110170110177
*/
110171110178
assert( pFJMatch==0 || cnt>0 );
110172110179
assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
110173110180
if( cnt!=1 ){
110174110181
const char *zErr;
@@ -110247,12 +110254,21 @@
110247110254
pExpr->op = eNewExprOp;
110248110255
lookupname_end:
110249110256
if( cnt==1 ){
110250110257
assert( pNC!=0 );
110251110258
#ifndef SQLITE_OMIT_AUTHORIZATION
110252
- if( db->xAuth && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER) ){
110253
- sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
110259
+ if( db->xAuth ){
110260
+ if( pFJMatch ){
110261
+ assert( pExpr->op==TK_FUNCTION );
110262
+ assert( sqlite3_stricmp(pExpr->u.zToken,"coalesce")==0 );
110263
+ assert( pExpr->x.pList==pFJMatch );
110264
+ assert( pFJMatch->nExpr>0 );
110265
+ pExpr = pFJMatch->a[0].pExpr;
110266
+ }
110267
+ if( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER ){
110268
+ sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
110269
+ }
110254110270
}
110255110271
#endif
110256110272
/* Increment the nRef value on all name contexts from TopNC up to
110257110273
** the point where the name matched. */
110258110274
for(;;){
@@ -115930,10 +115946,11 @@
115930115946
if( i!=nVector ){
115931115947
/* Need to reorder the LHS fields according to aiMap */
115932115948
int rLhsOrig = rLhs;
115933115949
rLhs = sqlite3GetTempRange(pParse, nVector);
115934115950
for(i=0; i<nVector; i++){
115951
+ testcase( aiMap[i]!=i );
115935115952
sqlite3VdbeAddOp3(v, OP_Copy, rLhsOrig+i, rLhs+aiMap[i], 0);
115936115953
}
115937115954
sqlite3ReleaseTempReg(pParse, rLhsOrig);
115938115955
}
115939115956
}
@@ -115950,11 +115967,12 @@
115950115967
}
115951115968
for(i=0; i<nVector; i++){
115952115969
Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i);
115953115970
if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error;
115954115971
if( sqlite3ExprCanBeNull(p) ){
115955
- sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2);
115972
+ testcase( aiMap[i]!=i );
115973
+ sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+aiMap[i], destStep2);
115956115974
VdbeCoverage(v);
115957115975
}
115958115976
}
115959115977
115960115978
/* Step 3. The LHS is now known to be non-NULL. Do the binary search
@@ -116024,13 +116042,23 @@
116024116042
for(i=0; i<nVector; i++){
116025116043
Expr *p;
116026116044
CollSeq *pColl;
116027116045
int r3 = sqlite3GetTempReg(pParse);
116028116046
p = sqlite3VectorFieldSubexpr(pLeft, i);
116029
- pColl = sqlite3ExprCollSeq(pParse, p);
116030
- sqlite3VdbeAddOp3(v, OP_Column, iTab, i, r3);
116031
- sqlite3VdbeAddOp4(v, OP_Ne, rLhs+i, destNotNull, r3,
116047
+ if( ExprUseXSelect(pExpr) ){
116048
+ Expr *pRhs = pExpr->x.pSelect->pEList->a[i].pExpr;
116049
+ pColl = sqlite3BinaryCompareCollSeq(pParse, p, pRhs);
116050
+ }else{
116051
+ /* If the RHS of the IN(...) expression are scalar expressions, do
116052
+ ** not consider their collation sequences. The documentation says
116053
+ ** "The collating sequence used for expressions of the form "x IN (y, z,
116054
+ ** ...)" is the collating sequence of x.". */
116055
+ pColl = sqlite3ExprCollSeq(pParse, p);
116056
+ }
116057
+ testcase( aiMap[i]!=i );
116058
+ sqlite3VdbeAddOp3(v, OP_Column, iTab, aiMap[i], r3);
116059
+ sqlite3VdbeAddOp4(v, OP_Ne, rLhs+aiMap[i], destNotNull, r3,
116032116060
(void*)pColl, P4_COLLSEQ);
116033116061
VdbeCoverage(v);
116034116062
sqlite3ReleaseTempReg(pParse, r3);
116035116063
}
116036116064
sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);
@@ -133231,13 +133259,22 @@
133231133259
x.nUsed = 0;
133232133260
x.apArg = argv+1;
133233133261
sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
133234133262
str.printfFlags = SQLITE_PRINTF_SQLFUNC;
133235133263
sqlite3_str_appendf(&str, zFormat, &x);
133236
- n = str.nChar;
133237
- sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
133238
- SQLITE_DYNAMIC);
133264
+ if( str.accError==SQLITE_OK ){
133265
+ n = str.nChar;
133266
+ sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
133267
+ SQLITE_DYNAMIC);
133268
+ }else{
133269
+ if( str.accError==SQLITE_NOMEM ){
133270
+ sqlite3_result_error_nomem(context);
133271
+ }else{
133272
+ sqlite3_result_error_toobig(context);
133273
+ }
133274
+ sqlite3_str_reset(&str);
133275
+ }
133239133276
}
133240133277
}
133241133278
133242133279
/*
133243133280
** Implementation of the substr() function.
@@ -135867,49 +135904,54 @@
135867135904
int iGt; /* Entries at or after a[iGt] are greater than rPivot */
135868135905
int i; /* Loop counter */
135869135906
double rPivot; /* The pivot value */
135870135907
135871135908
assert( n>=2 );
135872
- if( a[0]>a[n-1] ){
135873
- SWAP_DOUBLE(a[0],a[n-1])
135874
- }
135875
- if( n==2 ) return;
135876
- iGt = n-1;
135877
- i = n/2;
135878
- if( a[0]>a[i] ){
135879
- SWAP_DOUBLE(a[0],a[i])
135880
- }else if( a[i]>a[iGt] ){
135881
- SWAP_DOUBLE(a[i],a[iGt])
135882
- }
135883
- if( n==3 ) return;
135884
- rPivot = a[i];
135885
- iLt = i = 1;
135886
- do{
135887
- if( a[i]<rPivot ){
135888
- if( i>iLt ) SWAP_DOUBLE(a[i],a[iLt])
135889
- iLt++;
135890
- i++;
135891
- }else if( a[i]>rPivot ){
135892
- do{
135893
- iGt--;
135894
- }while( iGt>i && a[iGt]>rPivot );
135895
- SWAP_DOUBLE(a[i],a[iGt])
135896
- }else{
135897
- i++;
135898
- }
135899
- }while( i<iGt );
135900
- if( iLt>=2 ) percentSort(a, iLt);
135901
- if( n-iGt>=2 ) percentSort(a+iGt, n-iGt);
135902
-
135903
-/* Uncomment for testing */
135904
-#if 0
135905
- for(i=0; i<n-1; i++){
135906
- assert( a[i]<=a[i+1] );
135907
- }
135908
-#endif
135909
-}
135910
-
135909
+ do{
135910
+ if( a[0]>a[n-1] ){
135911
+ SWAP_DOUBLE(a[0],a[n-1])
135912
+ }
135913
+ if( n==2 ) return;
135914
+ iGt = n-1;
135915
+ i = n/2;
135916
+ if( a[0]>a[i] ){
135917
+ SWAP_DOUBLE(a[0],a[i])
135918
+ }else if( a[i]>a[iGt] ){
135919
+ SWAP_DOUBLE(a[i],a[iGt])
135920
+ }
135921
+ if( n==3 ) return;
135922
+ rPivot = a[i];
135923
+ iLt = i = 1;
135924
+ do{
135925
+ if( a[i]<rPivot ){
135926
+ if( i>iLt ) SWAP_DOUBLE(a[i],a[iLt])
135927
+ iLt++;
135928
+ i++;
135929
+ }else if( a[i]>rPivot ){
135930
+ do{
135931
+ iGt--;
135932
+ }while( iGt>i && a[iGt]>rPivot );
135933
+ SWAP_DOUBLE(a[i],a[iGt])
135934
+ }else{
135935
+ i++;
135936
+ }
135937
+ }while( i<iGt );
135938
+
135939
+ /* Recurse on the smaller partition only. The smaller partition
135940
+ ** will hold n/2 or fewer entries, which assures that the stack
135941
+ ** depth will not exceed O(log(n)), even for pathological cases.
135942
+ ** Loop without recursion for the larger partition. */
135943
+ if( iLt>n/2 ){
135944
+ if( n-iGt>=2 ) percentSort(a+iGt, n-iGt);
135945
+ n = iLt;
135946
+ }else{
135947
+ if( iLt>=2 ) percentSort(a, iLt);
135948
+ a += iGt;
135949
+ n -= iGt;
135950
+ }
135951
+ }while( n>=2 );
135952
+}
135911135953
135912135954
/*
135913135955
** The "inverse" function for percentile(Y,P) is called to remove a
135914135956
** row that was previously inserted by "step".
135915135957
*/
@@ -155479,12 +155521,15 @@
155479155521
** Then, if CheckOnCtx.iJoin indicates that this expression is part of an
155480155522
** ON clause from that SrcList (i.e. if iJoin is non-zero), check that it
155481155523
** does not refer to a table to the right of CheckOnCtx.iJoin. */
155482155524
do {
155483155525
SrcList *pSrc = pCtx->pSrc;
155526
+ int nSrc = pSrc->nSrc;
155484155527
int iTab = pExpr->iTable;
155485
- if( iTab>=pSrc->a[0].iCursor && iTab<=pSrc->a[pSrc->nSrc-1].iCursor ){
155528
+ int ii;
155529
+ for(ii=0; ii<nSrc && pSrc->a[ii].iCursor!=iTab; ii++){}
155530
+ if( ii<nSrc ){
155486155531
if( pCtx->iJoin && iTab>pCtx->iJoin ){
155487155532
sqlite3ErrorMsg(pWalker->pParse,
155488155533
"%s references tables to its right",
155489155534
(pCtx->bFuncArg ? "table-function argument" : "ON clause")
155490155535
);
@@ -165680,10 +165725,11 @@
165680165725
assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
165681165726
pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady,
165682165727
WO_EQ|WO_IN|WO_IS, 0);
165683165728
if( pAlt==0 ) continue;
165684165729
if( pAlt->wtFlags & (TERM_CODED) ) continue;
165730
+ if( ExprHasProperty(pAlt->pExpr, EP_Collate) ) continue;
165685165731
if( (pAlt->eOperator & WO_IN)
165686165732
&& ExprUseXSelect(pAlt->pExpr)
165687165733
&& (pAlt->pExpr->x.pSelect->pEList->nExpr>1)
165688165734
){
165689165735
continue;
@@ -166433,11 +166479,14 @@
166433166479
** Mark term iChild as being a child of term iParent
166434166480
*/
166435166481
static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
166436166482
pWC->a[iChild].iParent = iParent;
166437166483
pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
166484
+ assert( pWC->a[iParent].nChild < UMXV(pWC->a[0].nChild) );
166438166485
pWC->a[iParent].nChild++;
166486
+ testcase( pWC->a[iParent].nChild == UMXV(pWC->a[0].nChild) );
166487
+
166439166488
}
166440166489
166441166490
/*
166442166491
** Return the N-th AND-connected subterm of pTerm. Or if pTerm is not
166443166492
** a conjunction, then return just pTerm when N==0. If N is exceeds
@@ -166872,21 +166921,22 @@
166872166921
** 1. The SQLITE_Transitive optimization must be enabled
166873166922
** 2. Must be either an == or an IS operator
166874166923
** 3. Not originating in the ON clause of an OUTER JOIN
166875166924
** 4. The operator is not IS or else the query does not contain RIGHT JOIN
166876166925
** 5. The affinities of A and B must be compatible
166877
-** 6. Both operands use the same collating sequence
166926
+** 6. Both operands use the same collating sequence, and they must not
166927
+** use explicit COLLATE clauses.
166878166928
** If this routine returns TRUE, that means that the RHS can be substituted
166879166929
** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
166880166930
** This is an optimization. No harm comes from returning 0. But if 1 is
166881166931
** returned when it should not be, then incorrect answers might result.
166882166932
*/
166883166933
static int termIsEquivalence(Parse *pParse, Expr *pExpr, SrcList *pSrc){
166884166934
char aff1, aff2;
166885166935
if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; /* (1) */
166886166936
if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; /* (2) */
166887
- if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* (3) */
166937
+ if( ExprHasProperty(pExpr, EP_OuterON|EP_Collate) ) return 0; /* (3) */
166888166938
assert( pSrc!=0 );
166889166939
if( pExpr->op==TK_IS
166890166940
&& pSrc->nSrc>=2
166891166941
&& (pSrc->a[0].fg.jointype & JT_LTORJ)!=0
166892166942
){
@@ -167209,10 +167259,11 @@
167209167259
static const u8 ops[] = {TK_GE, TK_LE};
167210167260
assert( ExprUseXList(pExpr) );
167211167261
pList = pExpr->x.pList;
167212167262
assert( pList!=0 );
167213167263
assert( pList->nExpr==2 );
167264
+ assert( pWC->a[idxTerm].nChild==0 );
167214167265
for(i=0; i<2; i++){
167215167266
Expr *pNewExpr;
167216167267
int idxNew;
167217167268
pNewExpr = sqlite3PExpr(pParse, ops[i],
167218167269
sqlite3ExprDup(db, pExpr->pLeft, 0),
@@ -167419,12 +167470,15 @@
167419167470
&& (pExpr->x.pSelect->pPrior==0 || (pExpr->x.pSelect->selFlags & SF_Values))
167420167471
#ifndef SQLITE_OMIT_WINDOWFUNC
167421167472
&& pExpr->x.pSelect->pWin==0
167422167473
#endif
167423167474
&& pWC->op==TK_AND
167475
+ && pExpr->x.pSelect->pEList->nExpr <= UMXV(pTerm->nChild)
167476
+ /* ^-- See bug 2026-06-04T10:00:49Z */
167424167477
){
167425167478
int i;
167479
+ assert( pTerm->nChild==0 );
167426167480
for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){
167427167481
int idxNew;
167428167482
idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE);
167429167483
pWC->a[idxNew].u.x.iField = i+1;
167430167484
exprAnalyze(pSrc, pWC, idxNew);
@@ -186978,11 +187032,11 @@
186978187032
** or disables the collection of memory allocation statistics. */
186979187033
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
186980187034
break;
186981187035
}
186982187036
case SQLITE_CONFIG_SMALL_MALLOC: {
186983
- sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int);
187037
+ sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int)!=0;
186984187038
break;
186985187039
}
186986187040
case SQLITE_CONFIG_PAGECACHE: {
186987187041
/* EVIDENCE-OF: R-18761-36601 There are three arguments to
186988187042
** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem),
@@ -193287,10 +193341,16 @@
193287193341
#ifndef SQLITE_CORE
193288193342
/* # include "sqlite3ext.h" */
193289193343
SQLITE_EXTENSION_INIT1
193290193344
#endif
193291193345
193346
+
193347
+/*
193348
+** Assume any b-tree layer with more levels than this is corrupt.
193349
+*/
193350
+#define FTS3_MAX_BTREE_HEIGHT 48
193351
+
193292193352
typedef struct Fts3HashWrapper Fts3HashWrapper;
193293193353
struct Fts3HashWrapper {
193294193354
Fts3Hash hash; /* Hash table */
193295193355
int nRef; /* Number of pointers to this object */
193296193356
};
@@ -195003,11 +195063,15 @@
195003195063
int iHeight; /* Height of this node in tree */
195004195064
195005195065
assert( piLeaf || piLeaf2 );
195006195066
195007195067
fts3GetVarint32(zNode, &iHeight);
195008
- rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);
195068
+ if( iHeight>FTS3_MAX_BTREE_HEIGHT ){
195069
+ rc = FTS_CORRUPT_VTAB;
195070
+ }else{
195071
+ rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);
195072
+ }
195009195073
assert_fts3_nc( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );
195010195074
195011195075
if( rc==SQLITE_OK && iHeight>1 ){
195012195076
char *zBlob = 0; /* Blob read from %_segments table */
195013195077
int nBlob = 0; /* Size of zBlob in bytes */
@@ -199532,11 +199596,11 @@
199532199596
break;
199533199597
199534199598
/* State 3. The integer just read is a column number. */
199535199599
default: assert( eState==3 );
199536199600
iCol = (int)v;
199537
- if( iCol<1 || iCol>0x3fffffff ){
199601
+ if( iCol<1 || iCol>(pFts3->nColumn+1) ){
199538199602
rc = SQLITE_CORRUPT_VTAB;
199539199603
break;
199540199604
}
199541199605
if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;
199542199606
pCsr->aStat[iCol+1].nDoc++;
@@ -218910,11 +218974,11 @@
218910218974
i64 iRowid,
218911218975
int *piIndex
218912218976
){
218913218977
int ii;
218914218978
int nCell = NCELL(pNode);
218915
- assert( nCell<200 );
218979
+ assert( nCell<65536 && nCell>=0 );
218916218980
for(ii=0; ii<nCell; ii++){
218917218981
if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
218918218982
*piIndex = ii;
218919218983
return SQLITE_OK;
218920218984
}
@@ -223953,10 +224017,13 @@
223953224017
if( c>=0xc0 ){ \
223954224018
c = icuUtf8Trans1[c-0xc0]; \
223955224019
while( (*zIn & 0xc0)==0x80 ){ \
223956224020
c = (c<<6) + (0x3f & *(zIn++)); \
223957224021
} \
224022
+ if( c<0x80 \
224023
+ || (c&0xFFFFF800)==0xD800 \
224024
+ || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \
223958224025
}
223959224026
223960224027
#define SQLITE_ICU_SKIP_UTF8(zIn) \
223961224028
assert( *zIn ); \
223962224029
if( *(zIn++)>=0xc0 ){ \
@@ -244051,11 +244118,11 @@
244051244118
){
244052244119
HighlightContext ctx;
244053244120
int rc = SQLITE_OK; /* Return code */
244054244121
int iCol; /* 1st argument to snippet() */
244055244122
const char *zEllips; /* 4th argument to snippet() */
244056
- int nToken; /* 5th argument to snippet() */
244123
+ i64 nToken; /* 5th argument to snippet() */
244057244124
int nInst = 0; /* Number of instance matches this row */
244058244125
int i; /* Used to iterate through instances */
244059244126
int nPhrase; /* Number of phrases in query */
244060244127
unsigned char *aSeen; /* Array of "seen instance" flags */
244061244128
int iBestCol; /* Column containing best snippet */
@@ -244076,11 +244143,11 @@
244076244143
iCol = sqlite3_value_int(apVal[0]);
244077244144
ctx.zOpen = fts5ValueToText(apVal[1]);
244078244145
ctx.zClose = fts5ValueToText(apVal[2]);
244079244146
ctx.iRangeEnd = -1;
244080244147
zEllips = fts5ValueToText(apVal[3]);
244081
- nToken = sqlite3_value_int(apVal[4]);
244148
+ nToken = (int)(MIN( MAX(sqlite3_value_int64(apVal[4]), 0), 64));
244082244149
244083244150
iBestCol = (iCol>=0 ? iCol : 0);
244084244151
nPhrase = pApi->xPhraseCount(pFts);
244085244152
aSeen = sqlite3_malloc64(nPhrase);
244086244153
if( aSeen==0 ){
@@ -246792,11 +246859,11 @@
246792246859
/* Add an entry to each output position list */
246793246860
for(i=0; i<pNear->nPhrase; i++){
246794246861
i64 iPos = a[i].reader.iPos;
246795246862
Fts5PoslistWriter *pWriter = &a[i].writer;
246796246863
if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
246797
- sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos);
246864
+ sqlite3Fts5PoslistSafeAppend(a[i].pOut, &pWriter->iPrev, iPos);
246798246865
}
246799246866
}
246800246867
246801246868
iAdv = 0;
246802246869
iMin = a[0].reader.iLookahead;
@@ -251558,19 +251625,20 @@
251558251625
assert( pLvl->bEof==0 );
251559251626
if( iOff<=pLvl->iFirstOff ){
251560251627
pLvl->bEof = 1;
251561251628
}else{
251562251629
u8 *a = pLvl->pData->p;
251630
+ int nn = pLvl->pData->nn;
251563251631
251564251632
pLvl->iOff = 0;
251565251633
fts5DlidxLvlNext(pLvl);
251566251634
while( 1 ){
251567251635
int nZero = 0;
251568251636
int ii = pLvl->iOff;
251569251637
u64 delta = 0;
251570251638
251571
- while( a[ii]==0 ){
251639
+ while( ii<nn && a[ii]==0 ){
251572251640
nZero++;
251573251641
ii++;
251574251642
}
251575251643
ii += sqlite3Fts5GetVarint(&a[ii], &delta);
251576251644
@@ -251985,11 +252053,11 @@
251985252053
fts5DataRelease(pIter->pLeaf);
251986252054
pIter->pLeaf = 0;
251987252055
while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){
251988252056
Fts5Data *pNew;
251989252057
pIter->iLeafPgno--;
251990
- pNew = fts5DataRead(p, FTS5_SEGMENT_ROWID(
252058
+ pNew = fts5LeafRead(p, FTS5_SEGMENT_ROWID(
251991252059
pIter->pSeg->iSegid, pIter->iLeafPgno
251992252060
));
251993252061
if( pNew ){
251994252062
/* iTermLeafOffset may be equal to szLeaf if the term is the last
251995252063
** thing on the page - i.e. the first rowid is on the following page.
@@ -253419,12 +253487,11 @@
253419253487
}
253420253488
}
253421253489
253422253490
do {
253423253491
while( i<nChunk && pChunk[i]!=0x01 ){
253424
- while( pChunk[i] & 0x80 ) i++;
253425
- i++;
253492
+ fts5IndexSkipVarint(pChunk, i);
253426253493
}
253427253494
if( pCtx->eState ){
253428253495
fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);
253429253496
}
253430253497
if( i<nChunk ){
@@ -255163,10 +255230,15 @@
255163255230
int iSOP; /* Start-Of-Position-list */
255164255231
if( pSeg->iLeafPgno==pSeg->iTermLeafPgno ){
255165255232
iStart = pSeg->iTermLeafOffset;
255166255233
}else{
255167255234
iStart = fts5GetU16(&aPg[0]);
255235
+ }
255236
+ if( iStart>nPg ){
255237
+ FTS5_CORRUPT_IDX(p);
255238
+ sqlite3_free(aIdx);
255239
+ return;
255168255240
}
255169255241
255170255242
iSOP = iStart + fts5GetVarint(&aPg[iStart], &iDelta);
255171255243
assert_nc( iSOP<=pSeg->iLeafOffset );
255172255244
@@ -258429,11 +258501,11 @@
258429258501
){
258430258502
258431258503
/* Check any rowid-less pages that occur before the current leaf. */
258432258504
for(iPg=iPrevLeaf+1; iPg<fts5DlidxIterPgno(pDlidx); iPg++){
258433258505
iKey = FTS5_SEGMENT_ROWID(iSegid, iPg);
258434
- pLeaf = fts5DataRead(p, iKey);
258506
+ pLeaf = fts5LeafRead(p, iKey);
258435258507
if( pLeaf ){
258436258508
if( fts5LeafFirstRowidOff(pLeaf)!=0 ) FTS5_CORRUPT_ROWID(p, iKey);
258437258509
fts5DataRelease(pLeaf);
258438258510
}
258439258511
}
@@ -258440,11 +258512,11 @@
258440258512
iPrevLeaf = fts5DlidxIterPgno(pDlidx);
258441258513
258442258514
/* Check that the leaf page indicated by the iterator really does
258443258515
** contain the rowid suggested by the same. */
258444258516
iKey = FTS5_SEGMENT_ROWID(iSegid, iPrevLeaf);
258445
- pLeaf = fts5DataRead(p, iKey);
258517
+ pLeaf = fts5LeafRead(p, iKey);
258446258518
if( pLeaf ){
258447258519
i64 iRowid;
258448258520
int iRowidOff = fts5LeafFirstRowidOff(pLeaf);
258449258521
ASSERT_SZLEAF_OK(pLeaf);
258450258522
if( iRowidOff>=pLeaf->szLeaf ){
@@ -263040,11 +263112,11 @@
263040263112
int nArg, /* Number of args */
263041263113
sqlite3_value **apUnused /* Function arguments */
263042263114
){
263043263115
assert( nArg==0 );
263044263116
UNUSED_PARAM2(nArg, apUnused);
263045
- sqlite3_result_text(pCtx, "fts5: 2026-05-30 10:24:03 7487a1c59d3aaea9f8b2569dca76bbccf21948b1e7bd8a1d841e04382db696f4", -1, SQLITE_TRANSIENT);
263117
+ sqlite3_result_text(pCtx, "fts5: 2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0", -1, SQLITE_TRANSIENT);
263046263118
}
263047263119
263048263120
/*
263049263121
** Implementation of fts5_locale(LOCALE, TEXT) function.
263050263122
**
263051263123
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 2c605bfb1562d7a3609ad6ffd7446def12f1 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-05-30 13:23:25 2c605bfb1562d7a3609ad6ffd7446def12f1ac7084e41b9c6723e998c156501d"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-05-30T13:23:25.636Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -33389,12 +33389,12 @@
33389 if( flag_alternateform ){
33390 /* For %#q, do unistr()-style backslash escapes for
33391 ** all control characters, and for backslash itself.
33392 ** For %#Q, do the same but only if there is at least
33393 ** one control character. */
33394 u32 nBack = 0;
33395 u32 nCtrl = 0;
33396 for(k=0; k<i; k++){
33397 if( escarg[k]=='\\' ){
33398 nBack++;
33399 }else if( ((u8*)escarg)[k]<=0x1f ){
33400 nCtrl++;
@@ -56926,26 +56926,28 @@
56926 szBulk = -1024 * (i64)pcache1.nInitPage;
56927 }
56928 if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
56929 szBulk = pCache->szAlloc*(i64)pCache->nMax;
56930 }
56931 zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
56932 sqlite3EndBenignMalloc();
56933 if( zBulk ){
56934 int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
56935 do{
56936 PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
56937 pX->page.pBuf = zBulk;
56938 pX->page.pExtra = (u8*)pX + ROUND8(sizeof(*pX));
56939 assert( EIGHT_BYTE_ALIGNMENT( pX->page.pExtra ) );
56940 pX->isBulkLocal = 1;
56941 pX->isAnchor = 0;
56942 pX->pNext = pCache->pFree;
56943 pX->pLruPrev = 0; /* Initializing this saves a valgrind error */
56944 pCache->pFree = pX;
56945 zBulk += pCache->szAlloc;
56946 }while( --nBulk );
 
 
56947 }
56948 return pCache->pFree!=0;
56949 }
56950
56951 /*
@@ -83086,10 +83088,15 @@
83086 if( pc+info.nSize>usableSize ){
83087 checkAppendMsg(pCheck, "Extends off end of page");
83088 doCoverageCheck = 0;
83089 continue;
83090 }
 
 
 
 
 
83091
83092 /* Check for integer primary key out of range */
83093 if( pPage->intKey ){
83094 if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
83095 checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
@@ -84596,12 +84603,12 @@
84596 /* Work-around for GCC bug or bugs:
84597 ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270
84598 ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659
84599 ** The problem appears to be fixed in GCC 15 */
84600 i64 x;
84601 assert( (MEM_Str&~p->flags)*4==sizeof(x) );
84602 memcpy(&x, (char*)&p->u, (MEM_Str&~p->flags)*4);
84603 p->n = sqlite3Int64ToText(x, zBuf);
84604 #else
84605 p->n = sqlite3Int64ToText(p->u.i, zBuf);
84606 #endif
84607 if( p->flags & MEM_IntReal ){
@@ -95448,11 +95455,11 @@
95448 QueryPerformanceCounter(&tm);
95449 return (sqlite3_uint64)tm.QuadPart;
95450 }
95451
95452 #elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && \
95453 (defined(i386) || defined(__i386__) || defined(_M_IX86))
95454
95455 __inline__ sqlite_uint64 sqlite3Hwtime(void){
95456 unsigned int lo, hi;
95457 __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
95458 return (sqlite_uint64)hi << 32 | lo;
@@ -110164,11 +110171,11 @@
110164 /*
110165 ** cnt==0 means there was not match.
110166 ** cnt>1 means there were two or more matches.
110167 **
110168 ** cnt==0 is always an error. cnt>1 is often an error, but might
110169 ** be multiple matches for a NATURAL LEFT JOIN or a LEFT JOIN USING.
110170 */
110171 assert( pFJMatch==0 || cnt>0 );
110172 assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
110173 if( cnt!=1 ){
110174 const char *zErr;
@@ -110247,12 +110254,21 @@
110247 pExpr->op = eNewExprOp;
110248 lookupname_end:
110249 if( cnt==1 ){
110250 assert( pNC!=0 );
110251 #ifndef SQLITE_OMIT_AUTHORIZATION
110252 if( db->xAuth && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER) ){
110253 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
 
 
 
 
 
 
 
 
 
110254 }
110255 #endif
110256 /* Increment the nRef value on all name contexts from TopNC up to
110257 ** the point where the name matched. */
110258 for(;;){
@@ -115930,10 +115946,11 @@
115930 if( i!=nVector ){
115931 /* Need to reorder the LHS fields according to aiMap */
115932 int rLhsOrig = rLhs;
115933 rLhs = sqlite3GetTempRange(pParse, nVector);
115934 for(i=0; i<nVector; i++){
 
115935 sqlite3VdbeAddOp3(v, OP_Copy, rLhsOrig+i, rLhs+aiMap[i], 0);
115936 }
115937 sqlite3ReleaseTempReg(pParse, rLhsOrig);
115938 }
115939 }
@@ -115950,11 +115967,12 @@
115950 }
115951 for(i=0; i<nVector; i++){
115952 Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i);
115953 if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error;
115954 if( sqlite3ExprCanBeNull(p) ){
115955 sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2);
 
115956 VdbeCoverage(v);
115957 }
115958 }
115959
115960 /* Step 3. The LHS is now known to be non-NULL. Do the binary search
@@ -116024,13 +116042,23 @@
116024 for(i=0; i<nVector; i++){
116025 Expr *p;
116026 CollSeq *pColl;
116027 int r3 = sqlite3GetTempReg(pParse);
116028 p = sqlite3VectorFieldSubexpr(pLeft, i);
116029 pColl = sqlite3ExprCollSeq(pParse, p);
116030 sqlite3VdbeAddOp3(v, OP_Column, iTab, i, r3);
116031 sqlite3VdbeAddOp4(v, OP_Ne, rLhs+i, destNotNull, r3,
 
 
 
 
 
 
 
 
 
 
116032 (void*)pColl, P4_COLLSEQ);
116033 VdbeCoverage(v);
116034 sqlite3ReleaseTempReg(pParse, r3);
116035 }
116036 sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);
@@ -133231,13 +133259,22 @@
133231 x.nUsed = 0;
133232 x.apArg = argv+1;
133233 sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
133234 str.printfFlags = SQLITE_PRINTF_SQLFUNC;
133235 sqlite3_str_appendf(&str, zFormat, &x);
133236 n = str.nChar;
133237 sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
133238 SQLITE_DYNAMIC);
 
 
 
 
 
 
 
 
 
133239 }
133240 }
133241
133242 /*
133243 ** Implementation of the substr() function.
@@ -135867,49 +135904,54 @@
135867 int iGt; /* Entries at or after a[iGt] are greater than rPivot */
135868 int i; /* Loop counter */
135869 double rPivot; /* The pivot value */
135870
135871 assert( n>=2 );
135872 if( a[0]>a[n-1] ){
135873 SWAP_DOUBLE(a[0],a[n-1])
135874 }
135875 if( n==2 ) return;
135876 iGt = n-1;
135877 i = n/2;
135878 if( a[0]>a[i] ){
135879 SWAP_DOUBLE(a[0],a[i])
135880 }else if( a[i]>a[iGt] ){
135881 SWAP_DOUBLE(a[i],a[iGt])
135882 }
135883 if( n==3 ) return;
135884 rPivot = a[i];
135885 iLt = i = 1;
135886 do{
135887 if( a[i]<rPivot ){
135888 if( i>iLt ) SWAP_DOUBLE(a[i],a[iLt])
135889 iLt++;
135890 i++;
135891 }else if( a[i]>rPivot ){
135892 do{
135893 iGt--;
135894 }while( iGt>i && a[iGt]>rPivot );
135895 SWAP_DOUBLE(a[i],a[iGt])
135896 }else{
135897 i++;
135898 }
135899 }while( i<iGt );
135900 if( iLt>=2 ) percentSort(a, iLt);
135901 if( n-iGt>=2 ) percentSort(a+iGt, n-iGt);
135902
135903 /* Uncomment for testing */
135904 #if 0
135905 for(i=0; i<n-1; i++){
135906 assert( a[i]<=a[i+1] );
135907 }
135908 #endif
135909 }
135910
 
 
 
 
 
135911
135912 /*
135913 ** The "inverse" function for percentile(Y,P) is called to remove a
135914 ** row that was previously inserted by "step".
135915 */
@@ -155479,12 +155521,15 @@
155479 ** Then, if CheckOnCtx.iJoin indicates that this expression is part of an
155480 ** ON clause from that SrcList (i.e. if iJoin is non-zero), check that it
155481 ** does not refer to a table to the right of CheckOnCtx.iJoin. */
155482 do {
155483 SrcList *pSrc = pCtx->pSrc;
 
155484 int iTab = pExpr->iTable;
155485 if( iTab>=pSrc->a[0].iCursor && iTab<=pSrc->a[pSrc->nSrc-1].iCursor ){
 
 
155486 if( pCtx->iJoin && iTab>pCtx->iJoin ){
155487 sqlite3ErrorMsg(pWalker->pParse,
155488 "%s references tables to its right",
155489 (pCtx->bFuncArg ? "table-function argument" : "ON clause")
155490 );
@@ -165680,10 +165725,11 @@
165680 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
165681 pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady,
165682 WO_EQ|WO_IN|WO_IS, 0);
165683 if( pAlt==0 ) continue;
165684 if( pAlt->wtFlags & (TERM_CODED) ) continue;
 
165685 if( (pAlt->eOperator & WO_IN)
165686 && ExprUseXSelect(pAlt->pExpr)
165687 && (pAlt->pExpr->x.pSelect->pEList->nExpr>1)
165688 ){
165689 continue;
@@ -166433,11 +166479,14 @@
166433 ** Mark term iChild as being a child of term iParent
166434 */
166435 static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
166436 pWC->a[iChild].iParent = iParent;
166437 pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
 
166438 pWC->a[iParent].nChild++;
 
 
166439 }
166440
166441 /*
166442 ** Return the N-th AND-connected subterm of pTerm. Or if pTerm is not
166443 ** a conjunction, then return just pTerm when N==0. If N is exceeds
@@ -166872,21 +166921,22 @@
166872 ** 1. The SQLITE_Transitive optimization must be enabled
166873 ** 2. Must be either an == or an IS operator
166874 ** 3. Not originating in the ON clause of an OUTER JOIN
166875 ** 4. The operator is not IS or else the query does not contain RIGHT JOIN
166876 ** 5. The affinities of A and B must be compatible
166877 ** 6. Both operands use the same collating sequence
 
166878 ** If this routine returns TRUE, that means that the RHS can be substituted
166879 ** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
166880 ** This is an optimization. No harm comes from returning 0. But if 1 is
166881 ** returned when it should not be, then incorrect answers might result.
166882 */
166883 static int termIsEquivalence(Parse *pParse, Expr *pExpr, SrcList *pSrc){
166884 char aff1, aff2;
166885 if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; /* (1) */
166886 if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; /* (2) */
166887 if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* (3) */
166888 assert( pSrc!=0 );
166889 if( pExpr->op==TK_IS
166890 && pSrc->nSrc>=2
166891 && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0
166892 ){
@@ -167209,10 +167259,11 @@
167209 static const u8 ops[] = {TK_GE, TK_LE};
167210 assert( ExprUseXList(pExpr) );
167211 pList = pExpr->x.pList;
167212 assert( pList!=0 );
167213 assert( pList->nExpr==2 );
 
167214 for(i=0; i<2; i++){
167215 Expr *pNewExpr;
167216 int idxNew;
167217 pNewExpr = sqlite3PExpr(pParse, ops[i],
167218 sqlite3ExprDup(db, pExpr->pLeft, 0),
@@ -167419,12 +167470,15 @@
167419 && (pExpr->x.pSelect->pPrior==0 || (pExpr->x.pSelect->selFlags & SF_Values))
167420 #ifndef SQLITE_OMIT_WINDOWFUNC
167421 && pExpr->x.pSelect->pWin==0
167422 #endif
167423 && pWC->op==TK_AND
 
 
167424 ){
167425 int i;
 
167426 for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){
167427 int idxNew;
167428 idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE);
167429 pWC->a[idxNew].u.x.iField = i+1;
167430 exprAnalyze(pSrc, pWC, idxNew);
@@ -186978,11 +187032,11 @@
186978 ** or disables the collection of memory allocation statistics. */
186979 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
186980 break;
186981 }
186982 case SQLITE_CONFIG_SMALL_MALLOC: {
186983 sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int);
186984 break;
186985 }
186986 case SQLITE_CONFIG_PAGECACHE: {
186987 /* EVIDENCE-OF: R-18761-36601 There are three arguments to
186988 ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem),
@@ -193287,10 +193341,16 @@
193287 #ifndef SQLITE_CORE
193288 /* # include "sqlite3ext.h" */
193289 SQLITE_EXTENSION_INIT1
193290 #endif
193291
 
 
 
 
 
 
193292 typedef struct Fts3HashWrapper Fts3HashWrapper;
193293 struct Fts3HashWrapper {
193294 Fts3Hash hash; /* Hash table */
193295 int nRef; /* Number of pointers to this object */
193296 };
@@ -195003,11 +195063,15 @@
195003 int iHeight; /* Height of this node in tree */
195004
195005 assert( piLeaf || piLeaf2 );
195006
195007 fts3GetVarint32(zNode, &iHeight);
195008 rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);
 
 
 
 
195009 assert_fts3_nc( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );
195010
195011 if( rc==SQLITE_OK && iHeight>1 ){
195012 char *zBlob = 0; /* Blob read from %_segments table */
195013 int nBlob = 0; /* Size of zBlob in bytes */
@@ -199532,11 +199596,11 @@
199532 break;
199533
199534 /* State 3. The integer just read is a column number. */
199535 default: assert( eState==3 );
199536 iCol = (int)v;
199537 if( iCol<1 || iCol>0x3fffffff ){
199538 rc = SQLITE_CORRUPT_VTAB;
199539 break;
199540 }
199541 if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;
199542 pCsr->aStat[iCol+1].nDoc++;
@@ -218910,11 +218974,11 @@
218910 i64 iRowid,
218911 int *piIndex
218912 ){
218913 int ii;
218914 int nCell = NCELL(pNode);
218915 assert( nCell<200 );
218916 for(ii=0; ii<nCell; ii++){
218917 if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
218918 *piIndex = ii;
218919 return SQLITE_OK;
218920 }
@@ -223953,10 +224017,13 @@
223953 if( c>=0xc0 ){ \
223954 c = icuUtf8Trans1[c-0xc0]; \
223955 while( (*zIn & 0xc0)==0x80 ){ \
223956 c = (c<<6) + (0x3f & *(zIn++)); \
223957 } \
 
 
 
223958 }
223959
223960 #define SQLITE_ICU_SKIP_UTF8(zIn) \
223961 assert( *zIn ); \
223962 if( *(zIn++)>=0xc0 ){ \
@@ -244051,11 +244118,11 @@
244051 ){
244052 HighlightContext ctx;
244053 int rc = SQLITE_OK; /* Return code */
244054 int iCol; /* 1st argument to snippet() */
244055 const char *zEllips; /* 4th argument to snippet() */
244056 int nToken; /* 5th argument to snippet() */
244057 int nInst = 0; /* Number of instance matches this row */
244058 int i; /* Used to iterate through instances */
244059 int nPhrase; /* Number of phrases in query */
244060 unsigned char *aSeen; /* Array of "seen instance" flags */
244061 int iBestCol; /* Column containing best snippet */
@@ -244076,11 +244143,11 @@
244076 iCol = sqlite3_value_int(apVal[0]);
244077 ctx.zOpen = fts5ValueToText(apVal[1]);
244078 ctx.zClose = fts5ValueToText(apVal[2]);
244079 ctx.iRangeEnd = -1;
244080 zEllips = fts5ValueToText(apVal[3]);
244081 nToken = sqlite3_value_int(apVal[4]);
244082
244083 iBestCol = (iCol>=0 ? iCol : 0);
244084 nPhrase = pApi->xPhraseCount(pFts);
244085 aSeen = sqlite3_malloc64(nPhrase);
244086 if( aSeen==0 ){
@@ -246792,11 +246859,11 @@
246792 /* Add an entry to each output position list */
246793 for(i=0; i<pNear->nPhrase; i++){
246794 i64 iPos = a[i].reader.iPos;
246795 Fts5PoslistWriter *pWriter = &a[i].writer;
246796 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
246797 sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos);
246798 }
246799 }
246800
246801 iAdv = 0;
246802 iMin = a[0].reader.iLookahead;
@@ -251558,19 +251625,20 @@
251558 assert( pLvl->bEof==0 );
251559 if( iOff<=pLvl->iFirstOff ){
251560 pLvl->bEof = 1;
251561 }else{
251562 u8 *a = pLvl->pData->p;
 
251563
251564 pLvl->iOff = 0;
251565 fts5DlidxLvlNext(pLvl);
251566 while( 1 ){
251567 int nZero = 0;
251568 int ii = pLvl->iOff;
251569 u64 delta = 0;
251570
251571 while( a[ii]==0 ){
251572 nZero++;
251573 ii++;
251574 }
251575 ii += sqlite3Fts5GetVarint(&a[ii], &delta);
251576
@@ -251985,11 +252053,11 @@
251985 fts5DataRelease(pIter->pLeaf);
251986 pIter->pLeaf = 0;
251987 while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){
251988 Fts5Data *pNew;
251989 pIter->iLeafPgno--;
251990 pNew = fts5DataRead(p, FTS5_SEGMENT_ROWID(
251991 pIter->pSeg->iSegid, pIter->iLeafPgno
251992 ));
251993 if( pNew ){
251994 /* iTermLeafOffset may be equal to szLeaf if the term is the last
251995 ** thing on the page - i.e. the first rowid is on the following page.
@@ -253419,12 +253487,11 @@
253419 }
253420 }
253421
253422 do {
253423 while( i<nChunk && pChunk[i]!=0x01 ){
253424 while( pChunk[i] & 0x80 ) i++;
253425 i++;
253426 }
253427 if( pCtx->eState ){
253428 fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);
253429 }
253430 if( i<nChunk ){
@@ -255163,10 +255230,15 @@
255163 int iSOP; /* Start-Of-Position-list */
255164 if( pSeg->iLeafPgno==pSeg->iTermLeafPgno ){
255165 iStart = pSeg->iTermLeafOffset;
255166 }else{
255167 iStart = fts5GetU16(&aPg[0]);
 
 
 
 
 
255168 }
255169
255170 iSOP = iStart + fts5GetVarint(&aPg[iStart], &iDelta);
255171 assert_nc( iSOP<=pSeg->iLeafOffset );
255172
@@ -258429,11 +258501,11 @@
258429 ){
258430
258431 /* Check any rowid-less pages that occur before the current leaf. */
258432 for(iPg=iPrevLeaf+1; iPg<fts5DlidxIterPgno(pDlidx); iPg++){
258433 iKey = FTS5_SEGMENT_ROWID(iSegid, iPg);
258434 pLeaf = fts5DataRead(p, iKey);
258435 if( pLeaf ){
258436 if( fts5LeafFirstRowidOff(pLeaf)!=0 ) FTS5_CORRUPT_ROWID(p, iKey);
258437 fts5DataRelease(pLeaf);
258438 }
258439 }
@@ -258440,11 +258512,11 @@
258440 iPrevLeaf = fts5DlidxIterPgno(pDlidx);
258441
258442 /* Check that the leaf page indicated by the iterator really does
258443 ** contain the rowid suggested by the same. */
258444 iKey = FTS5_SEGMENT_ROWID(iSegid, iPrevLeaf);
258445 pLeaf = fts5DataRead(p, iKey);
258446 if( pLeaf ){
258447 i64 iRowid;
258448 int iRowidOff = fts5LeafFirstRowidOff(pLeaf);
258449 ASSERT_SZLEAF_OK(pLeaf);
258450 if( iRowidOff>=pLeaf->szLeaf ){
@@ -263040,11 +263112,11 @@
263040 int nArg, /* Number of args */
263041 sqlite3_value **apUnused /* Function arguments */
263042 ){
263043 assert( nArg==0 );
263044 UNUSED_PARAM2(nArg, apUnused);
263045 sqlite3_result_text(pCtx, "fts5: 2026-05-30 10:24:03 7487a1c59d3aaea9f8b2569dca76bbccf21948b1e7bd8a1d841e04382db696f4", -1, SQLITE_TRANSIENT);
263046 }
263047
263048 /*
263049 ** Implementation of fts5_locale(LOCALE, TEXT) function.
263050 **
263051
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 ** 4cb349370daab17123770c814c71872a3e4c with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -467,14 +467,14 @@
467 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468 ** [sqlite_version()] and [sqlite_source_id()].
469 */
470 #define SQLITE_VERSION "3.54.0"
471 #define SQLITE_VERSION_NUMBER 3054000
472 #define SQLITE_SOURCE_ID "2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-06-08T18:15:27.790Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -33389,12 +33389,12 @@
33389 if( flag_alternateform ){
33390 /* For %#q, do unistr()-style backslash escapes for
33391 ** all control characters, and for backslash itself.
33392 ** For %#Q, do the same but only if there is at least
33393 ** one control character. */
33394 i64 nBack = 0;
33395 i64 nCtrl = 0;
33396 for(k=0; k<i; k++){
33397 if( escarg[k]=='\\' ){
33398 nBack++;
33399 }else if( ((u8*)escarg)[k]<=0x1f ){
33400 nCtrl++;
@@ -56926,26 +56926,28 @@
56926 szBulk = -1024 * (i64)pcache1.nInitPage;
56927 }
56928 if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
56929 szBulk = pCache->szAlloc*(i64)pCache->nMax;
56930 }
56931 if( szBulk>=pCache->szAlloc ){
56932 zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
56933 sqlite3EndBenignMalloc();
56934 if( zBulk ){
56935 int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;
56936 do{
56937 PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];
56938 pX->page.pBuf = zBulk;
56939 pX->page.pExtra = (u8*)pX + ROUND8(sizeof(*pX));
56940 assert( EIGHT_BYTE_ALIGNMENT( pX->page.pExtra ) );
56941 pX->isBulkLocal = 1;
56942 pX->isAnchor = 0;
56943 pX->pNext = pCache->pFree;
56944 pX->pLruPrev = 0; /* Initializing this saves a valgrind error */
56945 pCache->pFree = pX;
56946 zBulk += pCache->szAlloc;
56947 }while( --nBulk );
56948 }
56949 }
56950 return pCache->pFree!=0;
56951 }
56952
56953 /*
@@ -83086,10 +83088,15 @@
83088 if( pc+info.nSize>usableSize ){
83089 checkAppendMsg(pCheck, "Extends off end of page");
83090 doCoverageCheck = 0;
83091 continue;
83092 }
83093 if( info.nPayload && info.pPayload[0]<2 ){
83094 checkAppendMsg(pCheck, "Bad cell header size");
83095 doCoverageCheck = 0;
83096 continue;
83097 }
83098
83099 /* Check for integer primary key out of range */
83100 if( pPage->intKey ){
83101 if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
83102 checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
@@ -84596,12 +84603,12 @@
84603 /* Work-around for GCC bug or bugs:
84604 ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270
84605 ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659
84606 ** The problem appears to be fixed in GCC 15 */
84607 i64 x;
84608 assert( (sqlite3Config.bSmallMalloc!=0xee)*8==sizeof(x) );
84609 memcpy(&x, (char*)&p->u.i, (sqlite3Config.bSmallMalloc!=0xee)*8);
84610 p->n = sqlite3Int64ToText(x, zBuf);
84611 #else
84612 p->n = sqlite3Int64ToText(p->u.i, zBuf);
84613 #endif
84614 if( p->flags & MEM_IntReal ){
@@ -95448,11 +95455,11 @@
95455 QueryPerformanceCounter(&tm);
95456 return (sqlite3_uint64)tm.QuadPart;
95457 }
95458
95459 #elif !defined(__STRICT_ANSI__) && defined(__GNUC__) && \
95460 (defined(i586) || defined(__i586__) || defined(_M_IX86))
95461
95462 __inline__ sqlite_uint64 sqlite3Hwtime(void){
95463 unsigned int lo, hi;
95464 __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
95465 return (sqlite_uint64)hi << 32 | lo;
@@ -110164,11 +110171,11 @@
110171 /*
110172 ** cnt==0 means there was not match.
110173 ** cnt>1 means there were two or more matches.
110174 **
110175 ** cnt==0 is always an error. cnt>1 is often an error, but might
110176 ** be multiple matches for a NATURAL OUTER JOIN or a OUTER JOIN USING.
110177 */
110178 assert( pFJMatch==0 || cnt>0 );
110179 assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) );
110180 if( cnt!=1 ){
110181 const char *zErr;
@@ -110247,12 +110254,21 @@
110254 pExpr->op = eNewExprOp;
110255 lookupname_end:
110256 if( cnt==1 ){
110257 assert( pNC!=0 );
110258 #ifndef SQLITE_OMIT_AUTHORIZATION
110259 if( db->xAuth ){
110260 if( pFJMatch ){
110261 assert( pExpr->op==TK_FUNCTION );
110262 assert( sqlite3_stricmp(pExpr->u.zToken,"coalesce")==0 );
110263 assert( pExpr->x.pList==pFJMatch );
110264 assert( pFJMatch->nExpr>0 );
110265 pExpr = pFJMatch->a[0].pExpr;
110266 }
110267 if( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER ){
110268 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
110269 }
110270 }
110271 #endif
110272 /* Increment the nRef value on all name contexts from TopNC up to
110273 ** the point where the name matched. */
110274 for(;;){
@@ -115930,10 +115946,11 @@
115946 if( i!=nVector ){
115947 /* Need to reorder the LHS fields according to aiMap */
115948 int rLhsOrig = rLhs;
115949 rLhs = sqlite3GetTempRange(pParse, nVector);
115950 for(i=0; i<nVector; i++){
115951 testcase( aiMap[i]!=i );
115952 sqlite3VdbeAddOp3(v, OP_Copy, rLhsOrig+i, rLhs+aiMap[i], 0);
115953 }
115954 sqlite3ReleaseTempReg(pParse, rLhsOrig);
115955 }
115956 }
@@ -115950,11 +115967,12 @@
115967 }
115968 for(i=0; i<nVector; i++){
115969 Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i);
115970 if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error;
115971 if( sqlite3ExprCanBeNull(p) ){
115972 testcase( aiMap[i]!=i );
115973 sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+aiMap[i], destStep2);
115974 VdbeCoverage(v);
115975 }
115976 }
115977
115978 /* Step 3. The LHS is now known to be non-NULL. Do the binary search
@@ -116024,13 +116042,23 @@
116042 for(i=0; i<nVector; i++){
116043 Expr *p;
116044 CollSeq *pColl;
116045 int r3 = sqlite3GetTempReg(pParse);
116046 p = sqlite3VectorFieldSubexpr(pLeft, i);
116047 if( ExprUseXSelect(pExpr) ){
116048 Expr *pRhs = pExpr->x.pSelect->pEList->a[i].pExpr;
116049 pColl = sqlite3BinaryCompareCollSeq(pParse, p, pRhs);
116050 }else{
116051 /* If the RHS of the IN(...) expression are scalar expressions, do
116052 ** not consider their collation sequences. The documentation says
116053 ** "The collating sequence used for expressions of the form "x IN (y, z,
116054 ** ...)" is the collating sequence of x.". */
116055 pColl = sqlite3ExprCollSeq(pParse, p);
116056 }
116057 testcase( aiMap[i]!=i );
116058 sqlite3VdbeAddOp3(v, OP_Column, iTab, aiMap[i], r3);
116059 sqlite3VdbeAddOp4(v, OP_Ne, rLhs+aiMap[i], destNotNull, r3,
116060 (void*)pColl, P4_COLLSEQ);
116061 VdbeCoverage(v);
116062 sqlite3ReleaseTempReg(pParse, r3);
116063 }
116064 sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);
@@ -133231,13 +133259,22 @@
133259 x.nUsed = 0;
133260 x.apArg = argv+1;
133261 sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
133262 str.printfFlags = SQLITE_PRINTF_SQLFUNC;
133263 sqlite3_str_appendf(&str, zFormat, &x);
133264 if( str.accError==SQLITE_OK ){
133265 n = str.nChar;
133266 sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,
133267 SQLITE_DYNAMIC);
133268 }else{
133269 if( str.accError==SQLITE_NOMEM ){
133270 sqlite3_result_error_nomem(context);
133271 }else{
133272 sqlite3_result_error_toobig(context);
133273 }
133274 sqlite3_str_reset(&str);
133275 }
133276 }
133277 }
133278
133279 /*
133280 ** Implementation of the substr() function.
@@ -135867,49 +135904,54 @@
135904 int iGt; /* Entries at or after a[iGt] are greater than rPivot */
135905 int i; /* Loop counter */
135906 double rPivot; /* The pivot value */
135907
135908 assert( n>=2 );
135909 do{
135910 if( a[0]>a[n-1] ){
135911 SWAP_DOUBLE(a[0],a[n-1])
135912 }
135913 if( n==2 ) return;
135914 iGt = n-1;
135915 i = n/2;
135916 if( a[0]>a[i] ){
135917 SWAP_DOUBLE(a[0],a[i])
135918 }else if( a[i]>a[iGt] ){
135919 SWAP_DOUBLE(a[i],a[iGt])
135920 }
135921 if( n==3 ) return;
135922 rPivot = a[i];
135923 iLt = i = 1;
135924 do{
135925 if( a[i]<rPivot ){
135926 if( i>iLt ) SWAP_DOUBLE(a[i],a[iLt])
135927 iLt++;
135928 i++;
135929 }else if( a[i]>rPivot ){
135930 do{
135931 iGt--;
135932 }while( iGt>i && a[iGt]>rPivot );
135933 SWAP_DOUBLE(a[i],a[iGt])
135934 }else{
135935 i++;
135936 }
135937 }while( i<iGt );
135938
135939 /* Recurse on the smaller partition only. The smaller partition
135940 ** will hold n/2 or fewer entries, which assures that the stack
135941 ** depth will not exceed O(log(n)), even for pathological cases.
135942 ** Loop without recursion for the larger partition. */
135943 if( iLt>n/2 ){
135944 if( n-iGt>=2 ) percentSort(a+iGt, n-iGt);
135945 n = iLt;
135946 }else{
135947 if( iLt>=2 ) percentSort(a, iLt);
135948 a += iGt;
135949 n -= iGt;
135950 }
135951 }while( n>=2 );
135952 }
135953
135954 /*
135955 ** The "inverse" function for percentile(Y,P) is called to remove a
135956 ** row that was previously inserted by "step".
135957 */
@@ -155479,12 +155521,15 @@
155521 ** Then, if CheckOnCtx.iJoin indicates that this expression is part of an
155522 ** ON clause from that SrcList (i.e. if iJoin is non-zero), check that it
155523 ** does not refer to a table to the right of CheckOnCtx.iJoin. */
155524 do {
155525 SrcList *pSrc = pCtx->pSrc;
155526 int nSrc = pSrc->nSrc;
155527 int iTab = pExpr->iTable;
155528 int ii;
155529 for(ii=0; ii<nSrc && pSrc->a[ii].iCursor!=iTab; ii++){}
155530 if( ii<nSrc ){
155531 if( pCtx->iJoin && iTab>pCtx->iJoin ){
155532 sqlite3ErrorMsg(pWalker->pParse,
155533 "%s references tables to its right",
155534 (pCtx->bFuncArg ? "table-function argument" : "ON clause")
155535 );
@@ -165680,10 +165725,11 @@
165725 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
165726 pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady,
165727 WO_EQ|WO_IN|WO_IS, 0);
165728 if( pAlt==0 ) continue;
165729 if( pAlt->wtFlags & (TERM_CODED) ) continue;
165730 if( ExprHasProperty(pAlt->pExpr, EP_Collate) ) continue;
165731 if( (pAlt->eOperator & WO_IN)
165732 && ExprUseXSelect(pAlt->pExpr)
165733 && (pAlt->pExpr->x.pSelect->pEList->nExpr>1)
165734 ){
165735 continue;
@@ -166433,11 +166479,14 @@
166479 ** Mark term iChild as being a child of term iParent
166480 */
166481 static void markTermAsChild(WhereClause *pWC, int iChild, int iParent){
166482 pWC->a[iChild].iParent = iParent;
166483 pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;
166484 assert( pWC->a[iParent].nChild < UMXV(pWC->a[0].nChild) );
166485 pWC->a[iParent].nChild++;
166486 testcase( pWC->a[iParent].nChild == UMXV(pWC->a[0].nChild) );
166487
166488 }
166489
166490 /*
166491 ** Return the N-th AND-connected subterm of pTerm. Or if pTerm is not
166492 ** a conjunction, then return just pTerm when N==0. If N is exceeds
@@ -166872,21 +166921,22 @@
166921 ** 1. The SQLITE_Transitive optimization must be enabled
166922 ** 2. Must be either an == or an IS operator
166923 ** 3. Not originating in the ON clause of an OUTER JOIN
166924 ** 4. The operator is not IS or else the query does not contain RIGHT JOIN
166925 ** 5. The affinities of A and B must be compatible
166926 ** 6. Both operands use the same collating sequence, and they must not
166927 ** use explicit COLLATE clauses.
166928 ** If this routine returns TRUE, that means that the RHS can be substituted
166929 ** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
166930 ** This is an optimization. No harm comes from returning 0. But if 1 is
166931 ** returned when it should not be, then incorrect answers might result.
166932 */
166933 static int termIsEquivalence(Parse *pParse, Expr *pExpr, SrcList *pSrc){
166934 char aff1, aff2;
166935 if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; /* (1) */
166936 if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; /* (2) */
166937 if( ExprHasProperty(pExpr, EP_OuterON|EP_Collate) ) return 0; /* (3) */
166938 assert( pSrc!=0 );
166939 if( pExpr->op==TK_IS
166940 && pSrc->nSrc>=2
166941 && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0
166942 ){
@@ -167209,10 +167259,11 @@
167259 static const u8 ops[] = {TK_GE, TK_LE};
167260 assert( ExprUseXList(pExpr) );
167261 pList = pExpr->x.pList;
167262 assert( pList!=0 );
167263 assert( pList->nExpr==2 );
167264 assert( pWC->a[idxTerm].nChild==0 );
167265 for(i=0; i<2; i++){
167266 Expr *pNewExpr;
167267 int idxNew;
167268 pNewExpr = sqlite3PExpr(pParse, ops[i],
167269 sqlite3ExprDup(db, pExpr->pLeft, 0),
@@ -167419,12 +167470,15 @@
167470 && (pExpr->x.pSelect->pPrior==0 || (pExpr->x.pSelect->selFlags & SF_Values))
167471 #ifndef SQLITE_OMIT_WINDOWFUNC
167472 && pExpr->x.pSelect->pWin==0
167473 #endif
167474 && pWC->op==TK_AND
167475 && pExpr->x.pSelect->pEList->nExpr <= UMXV(pTerm->nChild)
167476 /* ^-- See bug 2026-06-04T10:00:49Z */
167477 ){
167478 int i;
167479 assert( pTerm->nChild==0 );
167480 for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){
167481 int idxNew;
167482 idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE);
167483 pWC->a[idxNew].u.x.iField = i+1;
167484 exprAnalyze(pSrc, pWC, idxNew);
@@ -186978,11 +187032,11 @@
187032 ** or disables the collection of memory allocation statistics. */
187033 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
187034 break;
187035 }
187036 case SQLITE_CONFIG_SMALL_MALLOC: {
187037 sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int)!=0;
187038 break;
187039 }
187040 case SQLITE_CONFIG_PAGECACHE: {
187041 /* EVIDENCE-OF: R-18761-36601 There are three arguments to
187042 ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem),
@@ -193287,10 +193341,16 @@
193341 #ifndef SQLITE_CORE
193342 /* # include "sqlite3ext.h" */
193343 SQLITE_EXTENSION_INIT1
193344 #endif
193345
193346
193347 /*
193348 ** Assume any b-tree layer with more levels than this is corrupt.
193349 */
193350 #define FTS3_MAX_BTREE_HEIGHT 48
193351
193352 typedef struct Fts3HashWrapper Fts3HashWrapper;
193353 struct Fts3HashWrapper {
193354 Fts3Hash hash; /* Hash table */
193355 int nRef; /* Number of pointers to this object */
193356 };
@@ -195003,11 +195063,15 @@
195063 int iHeight; /* Height of this node in tree */
195064
195065 assert( piLeaf || piLeaf2 );
195066
195067 fts3GetVarint32(zNode, &iHeight);
195068 if( iHeight>FTS3_MAX_BTREE_HEIGHT ){
195069 rc = FTS_CORRUPT_VTAB;
195070 }else{
195071 rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);
195072 }
195073 assert_fts3_nc( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );
195074
195075 if( rc==SQLITE_OK && iHeight>1 ){
195076 char *zBlob = 0; /* Blob read from %_segments table */
195077 int nBlob = 0; /* Size of zBlob in bytes */
@@ -199532,11 +199596,11 @@
199596 break;
199597
199598 /* State 3. The integer just read is a column number. */
199599 default: assert( eState==3 );
199600 iCol = (int)v;
199601 if( iCol<1 || iCol>(pFts3->nColumn+1) ){
199602 rc = SQLITE_CORRUPT_VTAB;
199603 break;
199604 }
199605 if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;
199606 pCsr->aStat[iCol+1].nDoc++;
@@ -218910,11 +218974,11 @@
218974 i64 iRowid,
218975 int *piIndex
218976 ){
218977 int ii;
218978 int nCell = NCELL(pNode);
218979 assert( nCell<65536 && nCell>=0 );
218980 for(ii=0; ii<nCell; ii++){
218981 if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
218982 *piIndex = ii;
218983 return SQLITE_OK;
218984 }
@@ -223953,10 +224017,13 @@
224017 if( c>=0xc0 ){ \
224018 c = icuUtf8Trans1[c-0xc0]; \
224019 while( (*zIn & 0xc0)==0x80 ){ \
224020 c = (c<<6) + (0x3f & *(zIn++)); \
224021 } \
224022 if( c<0x80 \
224023 || (c&0xFFFFF800)==0xD800 \
224024 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \
224025 }
224026
224027 #define SQLITE_ICU_SKIP_UTF8(zIn) \
224028 assert( *zIn ); \
224029 if( *(zIn++)>=0xc0 ){ \
@@ -244051,11 +244118,11 @@
244118 ){
244119 HighlightContext ctx;
244120 int rc = SQLITE_OK; /* Return code */
244121 int iCol; /* 1st argument to snippet() */
244122 const char *zEllips; /* 4th argument to snippet() */
244123 i64 nToken; /* 5th argument to snippet() */
244124 int nInst = 0; /* Number of instance matches this row */
244125 int i; /* Used to iterate through instances */
244126 int nPhrase; /* Number of phrases in query */
244127 unsigned char *aSeen; /* Array of "seen instance" flags */
244128 int iBestCol; /* Column containing best snippet */
@@ -244076,11 +244143,11 @@
244143 iCol = sqlite3_value_int(apVal[0]);
244144 ctx.zOpen = fts5ValueToText(apVal[1]);
244145 ctx.zClose = fts5ValueToText(apVal[2]);
244146 ctx.iRangeEnd = -1;
244147 zEllips = fts5ValueToText(apVal[3]);
244148 nToken = (int)(MIN( MAX(sqlite3_value_int64(apVal[4]), 0), 64));
244149
244150 iBestCol = (iCol>=0 ? iCol : 0);
244151 nPhrase = pApi->xPhraseCount(pFts);
244152 aSeen = sqlite3_malloc64(nPhrase);
244153 if( aSeen==0 ){
@@ -246792,11 +246859,11 @@
246859 /* Add an entry to each output position list */
246860 for(i=0; i<pNear->nPhrase; i++){
246861 i64 iPos = a[i].reader.iPos;
246862 Fts5PoslistWriter *pWriter = &a[i].writer;
246863 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
246864 sqlite3Fts5PoslistSafeAppend(a[i].pOut, &pWriter->iPrev, iPos);
246865 }
246866 }
246867
246868 iAdv = 0;
246869 iMin = a[0].reader.iLookahead;
@@ -251558,19 +251625,20 @@
251625 assert( pLvl->bEof==0 );
251626 if( iOff<=pLvl->iFirstOff ){
251627 pLvl->bEof = 1;
251628 }else{
251629 u8 *a = pLvl->pData->p;
251630 int nn = pLvl->pData->nn;
251631
251632 pLvl->iOff = 0;
251633 fts5DlidxLvlNext(pLvl);
251634 while( 1 ){
251635 int nZero = 0;
251636 int ii = pLvl->iOff;
251637 u64 delta = 0;
251638
251639 while( ii<nn && a[ii]==0 ){
251640 nZero++;
251641 ii++;
251642 }
251643 ii += sqlite3Fts5GetVarint(&a[ii], &delta);
251644
@@ -251985,11 +252053,11 @@
252053 fts5DataRelease(pIter->pLeaf);
252054 pIter->pLeaf = 0;
252055 while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){
252056 Fts5Data *pNew;
252057 pIter->iLeafPgno--;
252058 pNew = fts5LeafRead(p, FTS5_SEGMENT_ROWID(
252059 pIter->pSeg->iSegid, pIter->iLeafPgno
252060 ));
252061 if( pNew ){
252062 /* iTermLeafOffset may be equal to szLeaf if the term is the last
252063 ** thing on the page - i.e. the first rowid is on the following page.
@@ -253419,12 +253487,11 @@
253487 }
253488 }
253489
253490 do {
253491 while( i<nChunk && pChunk[i]!=0x01 ){
253492 fts5IndexSkipVarint(pChunk, i);
 
253493 }
253494 if( pCtx->eState ){
253495 fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);
253496 }
253497 if( i<nChunk ){
@@ -255163,10 +255230,15 @@
255230 int iSOP; /* Start-Of-Position-list */
255231 if( pSeg->iLeafPgno==pSeg->iTermLeafPgno ){
255232 iStart = pSeg->iTermLeafOffset;
255233 }else{
255234 iStart = fts5GetU16(&aPg[0]);
255235 }
255236 if( iStart>nPg ){
255237 FTS5_CORRUPT_IDX(p);
255238 sqlite3_free(aIdx);
255239 return;
255240 }
255241
255242 iSOP = iStart + fts5GetVarint(&aPg[iStart], &iDelta);
255243 assert_nc( iSOP<=pSeg->iLeafOffset );
255244
@@ -258429,11 +258501,11 @@
258501 ){
258502
258503 /* Check any rowid-less pages that occur before the current leaf. */
258504 for(iPg=iPrevLeaf+1; iPg<fts5DlidxIterPgno(pDlidx); iPg++){
258505 iKey = FTS5_SEGMENT_ROWID(iSegid, iPg);
258506 pLeaf = fts5LeafRead(p, iKey);
258507 if( pLeaf ){
258508 if( fts5LeafFirstRowidOff(pLeaf)!=0 ) FTS5_CORRUPT_ROWID(p, iKey);
258509 fts5DataRelease(pLeaf);
258510 }
258511 }
@@ -258440,11 +258512,11 @@
258512 iPrevLeaf = fts5DlidxIterPgno(pDlidx);
258513
258514 /* Check that the leaf page indicated by the iterator really does
258515 ** contain the rowid suggested by the same. */
258516 iKey = FTS5_SEGMENT_ROWID(iSegid, iPrevLeaf);
258517 pLeaf = fts5LeafRead(p, iKey);
258518 if( pLeaf ){
258519 i64 iRowid;
258520 int iRowidOff = fts5LeafFirstRowidOff(pLeaf);
258521 ASSERT_SZLEAF_OK(pLeaf);
258522 if( iRowidOff>=pLeaf->szLeaf ){
@@ -263040,11 +263112,11 @@
263112 int nArg, /* Number of args */
263113 sqlite3_value **apUnused /* Function arguments */
263114 ){
263115 assert( nArg==0 );
263116 UNUSED_PARAM2(nArg, apUnused);
263117 sqlite3_result_text(pCtx, "fts5: 2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0", -1, SQLITE_TRANSIENT);
263118 }
263119
263120 /*
263121 ** Implementation of fts5_locale(LOCALE, TEXT) function.
263122 **
263123
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.54.0"
150150
#define SQLITE_VERSION_NUMBER 3054000
151
-#define SQLITE_SOURCE_ID "2026-05-30 13:23:25 2c605bfb1562d7a3609ad6ffd7446def12f1ac7084e41b9c6723e998c156501d"
151
+#define SQLITE_SOURCE_ID "2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2026-05-30T13:23:25.636Z"
154
+#define SQLITE_SCM_DATETIME "2026-06-08T18:15:27.790Z"
155155
156156
/*
157157
** CAPI3REF: Run-Time Library Version Numbers
158158
** KEYWORDS: sqlite3_version sqlite3_sourceid
159159
**
160160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-05-30 13:23:25 2c605bfb1562d7a3609ad6ffd7446def12f1ac7084e41b9c6723e998c156501d"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-05-30T13:23:25.636Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,14 +146,14 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.54.0"
150 #define SQLITE_VERSION_NUMBER 3054000
151 #define SQLITE_SOURCE_ID "2026-06-08 18:15:27 4cb349370daab17123770c814c71872a3e4c616a3f984569b3d7f97f9c3f5ea0"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-06-08T18:15:27.790Z"
155
156 /*
157 ** CAPI3REF: Run-Time Library Version Numbers
158 ** KEYWORDS: sqlite3_version sqlite3_sourceid
159 **
160

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button