Fossil SCM

Update the built-in SQLite to the latest trunk, in order to avoid a harmless compiler warning when compiling Fossil.

drh 2026-02-12 14:30 trunk
Commit 6c6c1feb55d6eee47e9af283944db82b55c714111b224e58668ad6567449bcd8
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -24454,17 +24454,19 @@
2445424454
static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
2445524455
return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
2445624456
(double)(pEnd->tv_sec - pStart->tv_sec);
2445724457
}
2445824458
24459
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
2445924460
/* Return the time since the start of the timer in
2446024461
** seconds. */
2446124462
static double elapseTime(ShellState *NotUsed){
2446224463
(void)NotUsed;
2446324464
if( iBegin==0 ) return 0.0;
2446424465
return (timeOfDay() - iBegin)*0.000001;
2446524466
}
24467
+#endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
2446624468
2446724469
/*
2446824470
** Print the timing results.
2446924471
*/
2447024472
static void endTimer(ShellState *p){
@@ -24545,17 +24547,19 @@
2454524547
sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
2454624548
sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
2454724549
return (double) ((i64End - i64Start) / 10000000.0);
2454824550
}
2454924551
24552
+#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
2455024553
/* Return the time since the start of the timer in
2455124554
** seconds. */
2455224555
static double elapseTime(ShellState *NotUsed){
2455324556
(void)NotUsed;
2455424557
if( ftWallBegin==0 ) return 0.0;
2455524558
return (timeOfDay() - ftWallBegin)*0.000001;
2455624559
}
24560
+#endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
2455724561
2455824562
/*
2455924563
** Print the timing results.
2456024564
*/
2456124565
static void endTimer(ShellState *p){
2456224566
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -24454,17 +24454,19 @@
24454 static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
24455 return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
24456 (double)(pEnd->tv_sec - pStart->tv_sec);
24457 }
24458
 
24459 /* Return the time since the start of the timer in
24460 ** seconds. */
24461 static double elapseTime(ShellState *NotUsed){
24462 (void)NotUsed;
24463 if( iBegin==0 ) return 0.0;
24464 return (timeOfDay() - iBegin)*0.000001;
24465 }
 
24466
24467 /*
24468 ** Print the timing results.
24469 */
24470 static void endTimer(ShellState *p){
@@ -24545,17 +24547,19 @@
24545 sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
24546 sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
24547 return (double) ((i64End - i64Start) / 10000000.0);
24548 }
24549
 
24550 /* Return the time since the start of the timer in
24551 ** seconds. */
24552 static double elapseTime(ShellState *NotUsed){
24553 (void)NotUsed;
24554 if( ftWallBegin==0 ) return 0.0;
24555 return (timeOfDay() - ftWallBegin)*0.000001;
24556 }
 
24557
24558 /*
24559 ** Print the timing results.
24560 */
24561 static void endTimer(ShellState *p){
24562
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -24454,17 +24454,19 @@
24454 static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
24455 return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
24456 (double)(pEnd->tv_sec - pStart->tv_sec);
24457 }
24458
24459 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
24460 /* Return the time since the start of the timer in
24461 ** seconds. */
24462 static double elapseTime(ShellState *NotUsed){
24463 (void)NotUsed;
24464 if( iBegin==0 ) return 0.0;
24465 return (timeOfDay() - iBegin)*0.000001;
24466 }
24467 #endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
24468
24469 /*
24470 ** Print the timing results.
24471 */
24472 static void endTimer(ShellState *p){
@@ -24545,17 +24547,19 @@
24547 sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
24548 sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
24549 return (double) ((i64End - i64Start) / 10000000.0);
24550 }
24551
24552 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
24553 /* Return the time since the start of the timer in
24554 ** seconds. */
24555 static double elapseTime(ShellState *NotUsed){
24556 (void)NotUsed;
24557 if( ftWallBegin==0 ) return 0.0;
24558 return (timeOfDay() - ftWallBegin)*0.000001;
24559 }
24560 #endif /* SQLITE_OMIT_PROGRESS_CALLBACK */
24561
24562 /*
24563 ** Print the timing results.
24564 */
24565 static void endTimer(ShellState *p){
24566
+107 -33
--- 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
-** c476d956d0bd3065cf894de6f9d393b999ff with changes in files:
21
+** b67889e4f17c3280f839ee7045256cc47d6c 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.52.0"
471471
#define SQLITE_VERSION_NUMBER 3052000
472
-#define SQLITE_SOURCE_ID "2026-02-04 20:51:27 c476d956d0bd3065cf894de6f9d393b999ff7d2268a35f01a6d88804789ab58f"
472
+#define SQLITE_SOURCE_ID "2026-02-10 19:33:11 b67889e4f17c3280f839ee7045256cc47d6ce3ed60d880925e3d30f9ebbcf3ff"
473473
#define SQLITE_SCM_BRANCH "trunk"
474474
#define SQLITE_SCM_TAGS ""
475
-#define SQLITE_SCM_DATETIME "2026-02-04T20:51:27.822Z"
475
+#define SQLITE_SCM_DATETIME "2026-02-10T19:33:11.305Z"
476476
477477
/*
478478
** CAPI3REF: Run-Time Library Version Numbers
479479
** KEYWORDS: sqlite3_version sqlite3_sourceid
480480
**
@@ -20359,11 +20359,11 @@
2035920359
#define SF_Distinct 0x0000001 /* Output should be DISTINCT */
2036020360
#define SF_All 0x0000002 /* Includes the ALL keyword */
2036120361
#define SF_Resolved 0x0000004 /* Identifiers have been resolved */
2036220362
#define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */
2036320363
#define SF_HasAgg 0x0000010 /* Contains aggregate functions */
20364
-/* 0x0000020 // available for reuse */
20364
+#define SF_ClonedRhsIn 0x0000020 /* Cloned RHS of an IN operator */
2036520365
#define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */
2036620366
#define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */
2036720367
#define SF_Compound 0x0000100 /* Part of a compound query */
2036820368
#define SF_Values 0x0000200 /* Synthesized from VALUES clause */
2036920369
#define SF_MultiValue 0x0000400 /* Single VALUES term with multiple rows */
@@ -22174,11 +22174,11 @@
2217422174
SQLITE_PRIVATE void sqlite3AlterAddConstraint(Parse*,SrcList*,Token*,Token*,const char*,int);
2217522175
SQLITE_PRIVATE void sqlite3AlterSetNotNull(Parse*, SrcList*, Token*, Token*);
2217622176
SQLITE_PRIVATE i64 sqlite3GetToken(const unsigned char *, int *);
2217722177
SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
2217822178
SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
22179
-SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
22179
+SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int);
2218022180
SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
2218122181
SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
2218222182
SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
2218322183
SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
2218422184
SQLITE_PRIVATE int sqlite3MatchEName(
@@ -34928,11 +34928,17 @@
3492834928
** sqlite3ShowWhereTerm() in where.c
3492934929
*/
3493034930
SQLITE_PRIVATE void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
3493134931
SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
3493234932
SQLITE_PRIVATE void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
34933
-SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList *p){ sqlite3TreeViewSrcList(0,p); }
34933
+SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList *p){
34934
+ TreeView *pView = 0;
34935
+ sqlite3TreeViewPush(&pView, 0);
34936
+ sqlite3TreeViewLine(pView, "SRCLIST");
34937
+ sqlite3TreeViewSrcList(pView,p);
34938
+ sqlite3TreeViewPop(&pView);
34939
+}
3493434940
SQLITE_PRIVATE void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
3493534941
SQLITE_PRIVATE void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
3493634942
SQLITE_PRIVATE void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
3493734943
#ifndef SQLITE_OMIT_TRIGGER
3493834944
SQLITE_PRIVATE void sqlite3ShowTriggerStep(const TriggerStep *p){
@@ -114883,18 +114889,25 @@
114883114889
/* Could not find an existing table or index to use as the RHS b-tree.
114884114890
** We will have to generate an ephemeral table to do the job.
114885114891
*/
114886114892
u32 savedNQueryLoop = pParse->nQueryLoop;
114887114893
int rMayHaveNull = 0;
114894
+ int bloomOk = (inFlags & IN_INDEX_MEMBERSHIP)!=0;
114888114895
eType = IN_INDEX_EPH;
114889114896
if( inFlags & IN_INDEX_LOOP ){
114890114897
pParse->nQueryLoop = 0;
114891114898
}else if( prRhsHasNull ){
114892114899
*prRhsHasNull = rMayHaveNull = ++pParse->nMem;
114893114900
}
114894114901
assert( pX->op==TK_IN );
114895
- sqlite3CodeRhsOfIN(pParse, pX, iTab);
114902
+ if( !bloomOk
114903
+ && ExprUseXSelect(pX)
114904
+ && (pX->x.pSelect->selFlags & SF_ClonedRhsIn)!=0
114905
+ ){
114906
+ bloomOk = 1;
114907
+ }
114908
+ sqlite3CodeRhsOfIN(pParse, pX, iTab, bloomOk);
114896114909
if( rMayHaveNull ){
114897114910
sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
114898114911
}
114899114912
pParse->nQueryLoop = savedNQueryLoop;
114900114913
}
@@ -115048,11 +115061,12 @@
115048115061
** is used.
115049115062
*/
115050115063
SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
115051115064
Parse *pParse, /* Parsing context */
115052115065
Expr *pExpr, /* The IN operator */
115053
- int iTab /* Use this cursor number */
115066
+ int iTab, /* Use this cursor number */
115067
+ int allowBloom /* True to allow the use of a Bloom filter */
115054115068
){
115055115069
int addrOnce = 0; /* Address of the OP_Once instruction at top */
115056115070
int addr; /* Address of OP_OpenEphemeral instruction */
115057115071
Expr *pLeft; /* the LHS of the IN operator */
115058115072
KeyInfo *pKeyInfo = 0; /* Key information */
@@ -115170,11 +115184,14 @@
115170115184
int rc;
115171115185
int addrBloom = 0;
115172115186
sqlite3SelectDestInit(&dest, SRT_Set, iTab);
115173115187
dest.zAffSdst = exprINAffinity(pParse, pExpr);
115174115188
pSelect->iLimit = 0;
115175
- if( addrOnce && OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
115189
+ if( addrOnce
115190
+ && allowBloom
115191
+ && OptimizationEnabled(pParse->db, SQLITE_BloomFilter)
115192
+ ){
115176115193
int regBloom = ++pParse->nMem;
115177115194
addrBloom = sqlite3VdbeAddOp2(v, OP_Blob, 10000, regBloom);
115178115195
VdbeComment((v, "Bloom filter"));
115179115196
dest.iSDParm2 = regBloom;
115180115197
}
@@ -124934,11 +124951,11 @@
124934124951
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
124935124952
#endif
124936124953
sqlite3_mutex_enter(db->mutex);
124937124954
db->xAuth = (sqlite3_xauth)xAuth;
124938124955
db->pAuthArg = pArg;
124939
- if( db->xAuth ) sqlite3ExpirePreparedStatements(db, 1);
124956
+ sqlite3ExpirePreparedStatements(db, 1);
124940124957
sqlite3_mutex_leave(db->mutex);
124941124958
return SQLITE_OK;
124942124959
}
124943124960
124944124961
/*
@@ -148217,10 +148234,14 @@
148217148234
p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->u3.pOn);
148218148235
pRight->u3.pOn = 0;
148219148236
pRight->fg.isOn = 1;
148220148237
p->selFlags |= SF_OnToWhere;
148221148238
}
148239
+
148240
+ if( IsVirtual(pRightTab) && joinType==EP_OuterON && pRight->u1.pFuncArg ){
148241
+ p->selFlags |= SF_OnToWhere;
148242
+ }
148222148243
}
148223148244
return 0;
148224148245
}
148225148246
148226148247
/*
@@ -152828,10 +152849,20 @@
152828152849
x.isOuterJoin = 0;
152829152850
x.nSelDepth = 0;
152830152851
x.pEList = pSubq->pEList;
152831152852
x.pCList = findLeftmostExprlist(pSubq);
152832152853
pNew = substExpr(&x, pNew);
152854
+ assert( pNew!=0 || pParse->nErr!=0 );
152855
+ if( pParse->nErr==0 && pNew->op==TK_IN && ExprUseXSelect(pNew) ){
152856
+ assert( pNew->x.pSelect!=0 );
152857
+ pNew->x.pSelect->selFlags |= SF_ClonedRhsIn;
152858
+ assert( pWhere!=0 );
152859
+ assert( pWhere->op==TK_IN );
152860
+ assert( ExprUseXSelect(pWhere) );
152861
+ assert( pWhere->x.pSelect!=0 );
152862
+ pWhere->x.pSelect->selFlags |= SF_ClonedRhsIn;
152863
+ }
152833152864
#ifndef SQLITE_OMIT_WINDOWFUNC
152834152865
if( pSubq->pWin && 0==pushDownWindowCheck(pParse, pSubq, pNew) ){
152835152866
/* Restriction 6c has prevented push-down in this case */
152836152867
sqlite3ExprDelete(pParse->db, pNew);
152837152868
nChng--;
@@ -154946,10 +154977,11 @@
154946154977
*/
154947154978
typedef struct CheckOnCtx CheckOnCtx;
154948154979
struct CheckOnCtx {
154949154980
SrcList *pSrc; /* SrcList for this context */
154950154981
int iJoin; /* Cursor numbers must be =< than this */
154982
+ int bFuncArg; /* True for table-function arg */
154951154983
CheckOnCtx *pParent; /* Parent context */
154952154984
};
154953154985
154954154986
/*
154955154987
** True if the SrcList passed as the only argument contains at least
@@ -154997,11 +155029,13 @@
154997155029
SrcList *pSrc = pCtx->pSrc;
154998155030
int iTab = pExpr->iTable;
154999155031
if( iTab>=pSrc->a[0].iCursor && iTab<=pSrc->a[pSrc->nSrc-1].iCursor ){
155000155032
if( pCtx->iJoin && iTab>pCtx->iJoin ){
155001155033
sqlite3ErrorMsg(pWalker->pParse,
155002
- "ON clause references tables to its right");
155034
+ "%s references tables to its right",
155035
+ (pCtx->bFuncArg ? "table-function argument" : "ON clause")
155036
+ );
155003155037
return WRC_Abort;
155004155038
}
155005155039
break;
155006155040
}
155007155041
pCtx = pCtx->pParent;
@@ -155035,21 +155069,36 @@
155035155069
** columns to the right.
155036155070
*/
155037155071
static void selectCheckOnClauses(Parse *pParse, Select *pSelect){
155038155072
Walker w;
155039155073
CheckOnCtx sCtx;
155074
+ int ii;
155040155075
assert( pSelect->selFlags & SF_OnToWhere );
155041155076
assert( pSelect->pSrc!=0 && pSelect->pSrc->nSrc>=2 );
155042155077
memset(&w, 0, sizeof(w));
155043155078
w.pParse = pParse;
155044155079
w.xExprCallback = selectCheckOnClausesExpr;
155045155080
w.xSelectCallback = selectCheckOnClausesSelect;
155046155081
w.u.pCheckOnCtx = &sCtx;
155047155082
memset(&sCtx, 0, sizeof(sCtx));
155048155083
sCtx.pSrc = pSelect->pSrc;
155049
- sqlite3WalkExprNN(&w, pSelect->pWhere);
155084
+ sqlite3WalkExpr(&w, pSelect->pWhere);
155050155085
pSelect->selFlags &= ~SF_OnToWhere;
155086
+
155087
+ /* Check for any table-function args that are attached to virtual tables
155088
+ ** on the RHS of an outer join. They are subject to the same constraints
155089
+ ** as ON clauses. */
155090
+ sCtx.bFuncArg = 1;
155091
+ for(ii=0; ii<pSelect->pSrc->nSrc; ii++){
155092
+ SrcItem *pItem = &pSelect->pSrc->a[ii];
155093
+ if( pItem->fg.isTabFunc
155094
+ && (pItem->fg.jointype & JT_OUTER)
155095
+ ){
155096
+ sCtx.iJoin = pItem->iCursor;
155097
+ sqlite3WalkExprList(&w, pItem->u1.pFuncArg);
155098
+ }
155099
+ }
155051155100
}
155052155101
155053155102
/*
155054155103
** If p2 exists and p1 and p2 have the same number of terms, then change
155055155104
** every term of p1 to have the same sort order as p2 and return true.
@@ -164043,11 +164092,11 @@
164043164092
if( NEVER(pTerm==0) ) continue;
164044164093
if( pTerm->eOperator & WO_IN ){
164045164094
if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){
164046164095
int iTab = pParse->nTab++;
164047164096
int iCache = ++pParse->nMem;
164048
- sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab);
164097
+ sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab, 0);
164049164098
sqlite3VdbeAddOp3(v, OP_VInitIn, iTab, iTarget, iCache);
164050164099
}else{
164051164100
codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);
164052164101
addrNotFound = pLevel->addrNxt;
164053164102
}
@@ -172943,16 +172992,25 @@
172943172992
**
172944172993
** 18 for star queries
172945172994
** 12 otherwise
172946172995
**
172947172996
** For the purposes of this heuristic, a star-query is defined as a query
172948
-** with a large central table that is joined using an INNER JOIN,
172949
-** not CROSS or OUTER JOINs, against four or more smaller tables.
172950
-** The central table is called the "fact" table. The smaller tables
172951
-** that get joined are "dimension tables". Also, any table that is
172952
-** self-joined cannot be a dimension table; we assume that dimension
172953
-** tables may only be joined against fact tables.
172997
+** with a central "fact" table that is joined against multiple
172998
+** "dimension" tables, subject to the following constraints:
172999
+**
173000
+** (aa) Only a five-way or larger join is considered for this
173001
+** optimization. If there are fewer than four terms in the FROM
173002
+** clause, this heuristic does not apply.
173003
+**
173004
+** (bb) The join between the fact table and the dimension tables must
173005
+** be an INNER join. CROSS and OUTER JOINs do not qualify.
173006
+**
173007
+** (cc) A table must have 3 or more dimension tables in order to be
173008
+** considered a fact table. (Was 4 prior to 2026-02-10.)
173009
+**
173010
+** (dd) A table that is a self-join cannot be a dimension table.
173011
+** Dimension tables are joined against fact tables.
172954173012
**
172955173013
** SIDE EFFECT: (and really the whole point of this subroutine)
172956173014
**
172957173015
** If pWInfo describes a star-query, then the cost for SCANs of dimension
172958173016
** WhereLoops is increased to be slightly larger than the cost of a SCAN
@@ -173001,11 +173059,11 @@
173001173059
assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) );
173002173060
assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab );
173003173061
}
173004173062
#endif /* SQLITE_DEBUG */
173005173063
173006
- if( nLoop>=5
173064
+ if( nLoop>=4 /* Constraint (aa) */
173007173065
&& !pWInfo->bStarDone
173008173066
&& OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery)
173009173067
){
173010173068
SrcItem *aFromTabs; /* All terms of the FROM clause */
173011173069
int iFromIdx; /* Term of FROM clause is the candidate fact-table */
@@ -173013,11 +173071,11 @@
173013173071
Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */
173014173072
WhereLoop *pStart; /* Where to start searching for dimension-tables */
173015173073
173016173074
pWInfo->bStarDone = 1; /* Only do this computation once */
173017173075
173018
- /* Look for fact tables with four or more dimensions where the
173076
+ /* Look for fact tables with three or more dimensions where the
173019173077
** dimension tables are not separately from the fact tables by an outer
173020173078
** or cross join. Adjust cost weights if found.
173021173079
*/
173022173080
assert( !pWInfo->bStarUsed );
173023173081
aFromTabs = pWInfo->pTabList->a;
@@ -173030,22 +173088,21 @@
173030173088
173031173089
pFactTab = aFromTabs + iFromIdx;
173032173090
if( (pFactTab->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173033173091
/* If the candidate fact-table is the right table of an outer join
173034173092
** restrict the search for dimension-tables to be tables to the right
173035
- ** of the fact-table. */
173036
- if( iFromIdx+4 > nLoop ) break; /* Impossible to reach nDep>=4 */
173093
+ ** of the fact-table. Constraint (bb) */
173094
+ if( iFromIdx+3 > nLoop ){
173095
+ break; /* ^-- Impossible to reach nDep>=2 - Constraint (cc) */
173096
+ }
173037173097
while( pStart && pStart->iTab<=iFromIdx ){
173038173098
pStart = pStart->pNextLoop;
173039173099
}
173040173100
}
173041173101
for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
173042173102
if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173043
- /* Fact-tables and dimension-tables cannot be separated by an
173044
- ** outer join (at least for the definition of fact- and dimension-
173045
- ** used by this heuristic). */
173046
- break;
173103
+ break; /* Constraint (bb) */
173047173104
}
173048173105
if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */
173049173106
&& (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */
173050173107
&& (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */
173051173108
){
@@ -173055,11 +173112,13 @@
173055173112
nDep++;
173056173113
mSeen |= pWLoop->maskSelf;
173057173114
}
173058173115
}
173059173116
}
173060
- if( nDep<=3 ) continue;
173117
+ if( nDep<=2 ){
173118
+ continue; /* Constraint (cc) */
173119
+ }
173061173120
173062173121
/* If we reach this point, it means that pFactTab is a fact table
173063173122
** with four or more dimensions connected by inner joins. Proceed
173064173123
** to make cost adjustments. */
173065173124
@@ -173068,10 +173127,27 @@
173068173127
if( !pWInfo->bStarUsed ){
173069173128
for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
173070173129
pWLoop->rStarDelta = 0;
173071173130
}
173072173131
}
173132
+#endif
173133
+#ifdef WHERETRACE_ENABLED /* 0x80000 */
173134
+ if( sqlite3WhereTrace & 0x80000 ){
173135
+ Bitmask mShow = mSeen;
173136
+ sqlite3DebugPrintf("Fact table %s(%d), dimensions:",
173137
+ pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
173138
+ iFromIdx);
173139
+ for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
173140
+ if( mShow & pWLoop->maskSelf ){
173141
+ SrcItem *pDim = aFromTabs + pWLoop->iTab;
173142
+ mShow &= ~pWLoop->maskSelf;
173143
+ sqlite3DebugPrintf(" %s(%d)",
173144
+ pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab);
173145
+ }
173146
+ }
173147
+ sqlite3DebugPrintf("\n");
173148
+ }
173073173149
#endif
173074173150
pWInfo->bStarUsed = 1;
173075173151
173076173152
/* Compute the maximum cost of any WhereLoop for the
173077173153
** fact table plus one epsilon */
@@ -173091,14 +173167,12 @@
173091173167
if( pWLoop->rRun<mxRun ){
173092173168
#ifdef WHERETRACE_ENABLED /* 0x80000 */
173093173169
if( sqlite3WhereTrace & 0x80000 ){
173094173170
SrcItem *pDim = aFromTabs + pWLoop->iTab;
173095173171
sqlite3DebugPrintf(
173096
- "Increase SCAN cost of dimension %s(%d) of fact %s(%d) to %d\n",
173097
- pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab,
173098
- pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
173099
- iFromIdx, mxRun
173172
+ "Increase SCAN cost of %s to %d\n",
173173
+ pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, mxRun
173100173174
);
173101173175
}
173102173176
pWLoop->rStarDelta = mxRun - pWLoop->rRun;
173103173177
#endif /* WHERETRACE_ENABLED */
173104173178
pWLoop->rRun = mxRun;
@@ -261473,11 +261547,11 @@
261473261547
int nArg, /* Number of args */
261474261548
sqlite3_value **apUnused /* Function arguments */
261475261549
){
261476261550
assert( nArg==0 );
261477261551
UNUSED_PARAM2(nArg, apUnused);
261478
- sqlite3_result_text(pCtx, "fts5: 2026-02-04 18:10:49 e6902937ecdbeb449986469859b46631272fb0a9e7e1c31adea14cff072b6d67", -1, SQLITE_TRANSIENT);
261552
+ sqlite3_result_text(pCtx, "fts5: 2026-02-11 19:42:46 38d8c0d8a0b0e9990ba7bdcce979f2824ffee22a083cb788a75917628b1eb559", -1, SQLITE_TRANSIENT);
261479261553
}
261480261554
261481261555
/*
261482261556
** Implementation of fts5_locale(LOCALE, TEXT) function.
261483261557
**
261484261558
--- 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 ** c476d956d0bd3065cf894de6f9d393b999ff 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.52.0"
471 #define SQLITE_VERSION_NUMBER 3052000
472 #define SQLITE_SOURCE_ID "2026-02-04 20:51:27 c476d956d0bd3065cf894de6f9d393b999ff7d2268a35f01a6d88804789ab58f"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-02-04T20:51:27.822Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -20359,11 +20359,11 @@
20359 #define SF_Distinct 0x0000001 /* Output should be DISTINCT */
20360 #define SF_All 0x0000002 /* Includes the ALL keyword */
20361 #define SF_Resolved 0x0000004 /* Identifiers have been resolved */
20362 #define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */
20363 #define SF_HasAgg 0x0000010 /* Contains aggregate functions */
20364 /* 0x0000020 // available for reuse */
20365 #define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */
20366 #define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */
20367 #define SF_Compound 0x0000100 /* Part of a compound query */
20368 #define SF_Values 0x0000200 /* Synthesized from VALUES clause */
20369 #define SF_MultiValue 0x0000400 /* Single VALUES term with multiple rows */
@@ -22174,11 +22174,11 @@
22174 SQLITE_PRIVATE void sqlite3AlterAddConstraint(Parse*,SrcList*,Token*,Token*,const char*,int);
22175 SQLITE_PRIVATE void sqlite3AlterSetNotNull(Parse*, SrcList*, Token*, Token*);
22176 SQLITE_PRIVATE i64 sqlite3GetToken(const unsigned char *, int *);
22177 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
22178 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
22179 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int);
22180 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
22181 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
22182 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
22183 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
22184 SQLITE_PRIVATE int sqlite3MatchEName(
@@ -34928,11 +34928,17 @@
34928 ** sqlite3ShowWhereTerm() in where.c
34929 */
34930 SQLITE_PRIVATE void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
34931 SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
34932 SQLITE_PRIVATE void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
34933 SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList *p){ sqlite3TreeViewSrcList(0,p); }
 
 
 
 
 
 
34934 SQLITE_PRIVATE void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
34935 SQLITE_PRIVATE void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
34936 SQLITE_PRIVATE void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
34937 #ifndef SQLITE_OMIT_TRIGGER
34938 SQLITE_PRIVATE void sqlite3ShowTriggerStep(const TriggerStep *p){
@@ -114883,18 +114889,25 @@
114883 /* Could not find an existing table or index to use as the RHS b-tree.
114884 ** We will have to generate an ephemeral table to do the job.
114885 */
114886 u32 savedNQueryLoop = pParse->nQueryLoop;
114887 int rMayHaveNull = 0;
 
114888 eType = IN_INDEX_EPH;
114889 if( inFlags & IN_INDEX_LOOP ){
114890 pParse->nQueryLoop = 0;
114891 }else if( prRhsHasNull ){
114892 *prRhsHasNull = rMayHaveNull = ++pParse->nMem;
114893 }
114894 assert( pX->op==TK_IN );
114895 sqlite3CodeRhsOfIN(pParse, pX, iTab);
 
 
 
 
 
 
114896 if( rMayHaveNull ){
114897 sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
114898 }
114899 pParse->nQueryLoop = savedNQueryLoop;
114900 }
@@ -115048,11 +115061,12 @@
115048 ** is used.
115049 */
115050 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
115051 Parse *pParse, /* Parsing context */
115052 Expr *pExpr, /* The IN operator */
115053 int iTab /* Use this cursor number */
 
115054 ){
115055 int addrOnce = 0; /* Address of the OP_Once instruction at top */
115056 int addr; /* Address of OP_OpenEphemeral instruction */
115057 Expr *pLeft; /* the LHS of the IN operator */
115058 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -115170,11 +115184,14 @@
115170 int rc;
115171 int addrBloom = 0;
115172 sqlite3SelectDestInit(&dest, SRT_Set, iTab);
115173 dest.zAffSdst = exprINAffinity(pParse, pExpr);
115174 pSelect->iLimit = 0;
115175 if( addrOnce && OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
 
 
 
115176 int regBloom = ++pParse->nMem;
115177 addrBloom = sqlite3VdbeAddOp2(v, OP_Blob, 10000, regBloom);
115178 VdbeComment((v, "Bloom filter"));
115179 dest.iSDParm2 = regBloom;
115180 }
@@ -124934,11 +124951,11 @@
124934 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
124935 #endif
124936 sqlite3_mutex_enter(db->mutex);
124937 db->xAuth = (sqlite3_xauth)xAuth;
124938 db->pAuthArg = pArg;
124939 if( db->xAuth ) sqlite3ExpirePreparedStatements(db, 1);
124940 sqlite3_mutex_leave(db->mutex);
124941 return SQLITE_OK;
124942 }
124943
124944 /*
@@ -148217,10 +148234,14 @@
148217 p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->u3.pOn);
148218 pRight->u3.pOn = 0;
148219 pRight->fg.isOn = 1;
148220 p->selFlags |= SF_OnToWhere;
148221 }
 
 
 
 
148222 }
148223 return 0;
148224 }
148225
148226 /*
@@ -152828,10 +152849,20 @@
152828 x.isOuterJoin = 0;
152829 x.nSelDepth = 0;
152830 x.pEList = pSubq->pEList;
152831 x.pCList = findLeftmostExprlist(pSubq);
152832 pNew = substExpr(&x, pNew);
 
 
 
 
 
 
 
 
 
 
152833 #ifndef SQLITE_OMIT_WINDOWFUNC
152834 if( pSubq->pWin && 0==pushDownWindowCheck(pParse, pSubq, pNew) ){
152835 /* Restriction 6c has prevented push-down in this case */
152836 sqlite3ExprDelete(pParse->db, pNew);
152837 nChng--;
@@ -154946,10 +154977,11 @@
154946 */
154947 typedef struct CheckOnCtx CheckOnCtx;
154948 struct CheckOnCtx {
154949 SrcList *pSrc; /* SrcList for this context */
154950 int iJoin; /* Cursor numbers must be =< than this */
 
154951 CheckOnCtx *pParent; /* Parent context */
154952 };
154953
154954 /*
154955 ** True if the SrcList passed as the only argument contains at least
@@ -154997,11 +155029,13 @@
154997 SrcList *pSrc = pCtx->pSrc;
154998 int iTab = pExpr->iTable;
154999 if( iTab>=pSrc->a[0].iCursor && iTab<=pSrc->a[pSrc->nSrc-1].iCursor ){
155000 if( pCtx->iJoin && iTab>pCtx->iJoin ){
155001 sqlite3ErrorMsg(pWalker->pParse,
155002 "ON clause references tables to its right");
 
 
155003 return WRC_Abort;
155004 }
155005 break;
155006 }
155007 pCtx = pCtx->pParent;
@@ -155035,21 +155069,36 @@
155035 ** columns to the right.
155036 */
155037 static void selectCheckOnClauses(Parse *pParse, Select *pSelect){
155038 Walker w;
155039 CheckOnCtx sCtx;
 
155040 assert( pSelect->selFlags & SF_OnToWhere );
155041 assert( pSelect->pSrc!=0 && pSelect->pSrc->nSrc>=2 );
155042 memset(&w, 0, sizeof(w));
155043 w.pParse = pParse;
155044 w.xExprCallback = selectCheckOnClausesExpr;
155045 w.xSelectCallback = selectCheckOnClausesSelect;
155046 w.u.pCheckOnCtx = &sCtx;
155047 memset(&sCtx, 0, sizeof(sCtx));
155048 sCtx.pSrc = pSelect->pSrc;
155049 sqlite3WalkExprNN(&w, pSelect->pWhere);
155050 pSelect->selFlags &= ~SF_OnToWhere;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155051 }
155052
155053 /*
155054 ** If p2 exists and p1 and p2 have the same number of terms, then change
155055 ** every term of p1 to have the same sort order as p2 and return true.
@@ -164043,11 +164092,11 @@
164043 if( NEVER(pTerm==0) ) continue;
164044 if( pTerm->eOperator & WO_IN ){
164045 if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){
164046 int iTab = pParse->nTab++;
164047 int iCache = ++pParse->nMem;
164048 sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab);
164049 sqlite3VdbeAddOp3(v, OP_VInitIn, iTab, iTarget, iCache);
164050 }else{
164051 codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);
164052 addrNotFound = pLevel->addrNxt;
164053 }
@@ -172943,16 +172992,25 @@
172943 **
172944 ** 18 for star queries
172945 ** 12 otherwise
172946 **
172947 ** For the purposes of this heuristic, a star-query is defined as a query
172948 ** with a large central table that is joined using an INNER JOIN,
172949 ** not CROSS or OUTER JOINs, against four or more smaller tables.
172950 ** The central table is called the "fact" table. The smaller tables
172951 ** that get joined are "dimension tables". Also, any table that is
172952 ** self-joined cannot be a dimension table; we assume that dimension
172953 ** tables may only be joined against fact tables.
 
 
 
 
 
 
 
 
 
172954 **
172955 ** SIDE EFFECT: (and really the whole point of this subroutine)
172956 **
172957 ** If pWInfo describes a star-query, then the cost for SCANs of dimension
172958 ** WhereLoops is increased to be slightly larger than the cost of a SCAN
@@ -173001,11 +173059,11 @@
173001 assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) );
173002 assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab );
173003 }
173004 #endif /* SQLITE_DEBUG */
173005
173006 if( nLoop>=5
173007 && !pWInfo->bStarDone
173008 && OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery)
173009 ){
173010 SrcItem *aFromTabs; /* All terms of the FROM clause */
173011 int iFromIdx; /* Term of FROM clause is the candidate fact-table */
@@ -173013,11 +173071,11 @@
173013 Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */
173014 WhereLoop *pStart; /* Where to start searching for dimension-tables */
173015
173016 pWInfo->bStarDone = 1; /* Only do this computation once */
173017
173018 /* Look for fact tables with four or more dimensions where the
173019 ** dimension tables are not separately from the fact tables by an outer
173020 ** or cross join. Adjust cost weights if found.
173021 */
173022 assert( !pWInfo->bStarUsed );
173023 aFromTabs = pWInfo->pTabList->a;
@@ -173030,22 +173088,21 @@
173030
173031 pFactTab = aFromTabs + iFromIdx;
173032 if( (pFactTab->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173033 /* If the candidate fact-table is the right table of an outer join
173034 ** restrict the search for dimension-tables to be tables to the right
173035 ** of the fact-table. */
173036 if( iFromIdx+4 > nLoop ) break; /* Impossible to reach nDep>=4 */
 
 
173037 while( pStart && pStart->iTab<=iFromIdx ){
173038 pStart = pStart->pNextLoop;
173039 }
173040 }
173041 for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
173042 if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173043 /* Fact-tables and dimension-tables cannot be separated by an
173044 ** outer join (at least for the definition of fact- and dimension-
173045 ** used by this heuristic). */
173046 break;
173047 }
173048 if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */
173049 && (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */
173050 && (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */
173051 ){
@@ -173055,11 +173112,13 @@
173055 nDep++;
173056 mSeen |= pWLoop->maskSelf;
173057 }
173058 }
173059 }
173060 if( nDep<=3 ) continue;
 
 
173061
173062 /* If we reach this point, it means that pFactTab is a fact table
173063 ** with four or more dimensions connected by inner joins. Proceed
173064 ** to make cost adjustments. */
173065
@@ -173068,10 +173127,27 @@
173068 if( !pWInfo->bStarUsed ){
173069 for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
173070 pWLoop->rStarDelta = 0;
173071 }
173072 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173073 #endif
173074 pWInfo->bStarUsed = 1;
173075
173076 /* Compute the maximum cost of any WhereLoop for the
173077 ** fact table plus one epsilon */
@@ -173091,14 +173167,12 @@
173091 if( pWLoop->rRun<mxRun ){
173092 #ifdef WHERETRACE_ENABLED /* 0x80000 */
173093 if( sqlite3WhereTrace & 0x80000 ){
173094 SrcItem *pDim = aFromTabs + pWLoop->iTab;
173095 sqlite3DebugPrintf(
173096 "Increase SCAN cost of dimension %s(%d) of fact %s(%d) to %d\n",
173097 pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab,
173098 pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
173099 iFromIdx, mxRun
173100 );
173101 }
173102 pWLoop->rStarDelta = mxRun - pWLoop->rRun;
173103 #endif /* WHERETRACE_ENABLED */
173104 pWLoop->rRun = mxRun;
@@ -261473,11 +261547,11 @@
261473 int nArg, /* Number of args */
261474 sqlite3_value **apUnused /* Function arguments */
261475 ){
261476 assert( nArg==0 );
261477 UNUSED_PARAM2(nArg, apUnused);
261478 sqlite3_result_text(pCtx, "fts5: 2026-02-04 18:10:49 e6902937ecdbeb449986469859b46631272fb0a9e7e1c31adea14cff072b6d67", -1, SQLITE_TRANSIENT);
261479 }
261480
261481 /*
261482 ** Implementation of fts5_locale(LOCALE, TEXT) function.
261483 **
261484
--- 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 ** b67889e4f17c3280f839ee7045256cc47d6c 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.52.0"
471 #define SQLITE_VERSION_NUMBER 3052000
472 #define SQLITE_SOURCE_ID "2026-02-10 19:33:11 b67889e4f17c3280f839ee7045256cc47d6ce3ed60d880925e3d30f9ebbcf3ff"
473 #define SQLITE_SCM_BRANCH "trunk"
474 #define SQLITE_SCM_TAGS ""
475 #define SQLITE_SCM_DATETIME "2026-02-10T19:33:11.305Z"
476
477 /*
478 ** CAPI3REF: Run-Time Library Version Numbers
479 ** KEYWORDS: sqlite3_version sqlite3_sourceid
480 **
@@ -20359,11 +20359,11 @@
20359 #define SF_Distinct 0x0000001 /* Output should be DISTINCT */
20360 #define SF_All 0x0000002 /* Includes the ALL keyword */
20361 #define SF_Resolved 0x0000004 /* Identifiers have been resolved */
20362 #define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */
20363 #define SF_HasAgg 0x0000010 /* Contains aggregate functions */
20364 #define SF_ClonedRhsIn 0x0000020 /* Cloned RHS of an IN operator */
20365 #define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */
20366 #define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */
20367 #define SF_Compound 0x0000100 /* Part of a compound query */
20368 #define SF_Values 0x0000200 /* Synthesized from VALUES clause */
20369 #define SF_MultiValue 0x0000400 /* Single VALUES term with multiple rows */
@@ -22174,11 +22174,11 @@
22174 SQLITE_PRIVATE void sqlite3AlterAddConstraint(Parse*,SrcList*,Token*,Token*,const char*,int);
22175 SQLITE_PRIVATE void sqlite3AlterSetNotNull(Parse*, SrcList*, Token*, Token*);
22176 SQLITE_PRIVATE i64 sqlite3GetToken(const unsigned char *, int *);
22177 SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...);
22178 SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int);
22179 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(Parse*, Expr*, int, int);
22180 SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr*);
22181 SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*);
22182 SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, SrcItem*);
22183 SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);
22184 SQLITE_PRIVATE int sqlite3MatchEName(
@@ -34928,11 +34928,17 @@
34928 ** sqlite3ShowWhereTerm() in where.c
34929 */
34930 SQLITE_PRIVATE void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
34931 SQLITE_PRIVATE void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
34932 SQLITE_PRIVATE void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
34933 SQLITE_PRIVATE void sqlite3ShowSrcList(const SrcList *p){
34934 TreeView *pView = 0;
34935 sqlite3TreeViewPush(&pView, 0);
34936 sqlite3TreeViewLine(pView, "SRCLIST");
34937 sqlite3TreeViewSrcList(pView,p);
34938 sqlite3TreeViewPop(&pView);
34939 }
34940 SQLITE_PRIVATE void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
34941 SQLITE_PRIVATE void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
34942 SQLITE_PRIVATE void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
34943 #ifndef SQLITE_OMIT_TRIGGER
34944 SQLITE_PRIVATE void sqlite3ShowTriggerStep(const TriggerStep *p){
@@ -114883,18 +114889,25 @@
114889 /* Could not find an existing table or index to use as the RHS b-tree.
114890 ** We will have to generate an ephemeral table to do the job.
114891 */
114892 u32 savedNQueryLoop = pParse->nQueryLoop;
114893 int rMayHaveNull = 0;
114894 int bloomOk = (inFlags & IN_INDEX_MEMBERSHIP)!=0;
114895 eType = IN_INDEX_EPH;
114896 if( inFlags & IN_INDEX_LOOP ){
114897 pParse->nQueryLoop = 0;
114898 }else if( prRhsHasNull ){
114899 *prRhsHasNull = rMayHaveNull = ++pParse->nMem;
114900 }
114901 assert( pX->op==TK_IN );
114902 if( !bloomOk
114903 && ExprUseXSelect(pX)
114904 && (pX->x.pSelect->selFlags & SF_ClonedRhsIn)!=0
114905 ){
114906 bloomOk = 1;
114907 }
114908 sqlite3CodeRhsOfIN(pParse, pX, iTab, bloomOk);
114909 if( rMayHaveNull ){
114910 sqlite3SetHasNullFlag(v, iTab, rMayHaveNull);
114911 }
114912 pParse->nQueryLoop = savedNQueryLoop;
114913 }
@@ -115048,11 +115061,12 @@
115061 ** is used.
115062 */
115063 SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
115064 Parse *pParse, /* Parsing context */
115065 Expr *pExpr, /* The IN operator */
115066 int iTab, /* Use this cursor number */
115067 int allowBloom /* True to allow the use of a Bloom filter */
115068 ){
115069 int addrOnce = 0; /* Address of the OP_Once instruction at top */
115070 int addr; /* Address of OP_OpenEphemeral instruction */
115071 Expr *pLeft; /* the LHS of the IN operator */
115072 KeyInfo *pKeyInfo = 0; /* Key information */
@@ -115170,11 +115184,14 @@
115184 int rc;
115185 int addrBloom = 0;
115186 sqlite3SelectDestInit(&dest, SRT_Set, iTab);
115187 dest.zAffSdst = exprINAffinity(pParse, pExpr);
115188 pSelect->iLimit = 0;
115189 if( addrOnce
115190 && allowBloom
115191 && OptimizationEnabled(pParse->db, SQLITE_BloomFilter)
115192 ){
115193 int regBloom = ++pParse->nMem;
115194 addrBloom = sqlite3VdbeAddOp2(v, OP_Blob, 10000, regBloom);
115195 VdbeComment((v, "Bloom filter"));
115196 dest.iSDParm2 = regBloom;
115197 }
@@ -124934,11 +124951,11 @@
124951 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
124952 #endif
124953 sqlite3_mutex_enter(db->mutex);
124954 db->xAuth = (sqlite3_xauth)xAuth;
124955 db->pAuthArg = pArg;
124956 sqlite3ExpirePreparedStatements(db, 1);
124957 sqlite3_mutex_leave(db->mutex);
124958 return SQLITE_OK;
124959 }
124960
124961 /*
@@ -148217,10 +148234,14 @@
148234 p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->u3.pOn);
148235 pRight->u3.pOn = 0;
148236 pRight->fg.isOn = 1;
148237 p->selFlags |= SF_OnToWhere;
148238 }
148239
148240 if( IsVirtual(pRightTab) && joinType==EP_OuterON && pRight->u1.pFuncArg ){
148241 p->selFlags |= SF_OnToWhere;
148242 }
148243 }
148244 return 0;
148245 }
148246
148247 /*
@@ -152828,10 +152849,20 @@
152849 x.isOuterJoin = 0;
152850 x.nSelDepth = 0;
152851 x.pEList = pSubq->pEList;
152852 x.pCList = findLeftmostExprlist(pSubq);
152853 pNew = substExpr(&x, pNew);
152854 assert( pNew!=0 || pParse->nErr!=0 );
152855 if( pParse->nErr==0 && pNew->op==TK_IN && ExprUseXSelect(pNew) ){
152856 assert( pNew->x.pSelect!=0 );
152857 pNew->x.pSelect->selFlags |= SF_ClonedRhsIn;
152858 assert( pWhere!=0 );
152859 assert( pWhere->op==TK_IN );
152860 assert( ExprUseXSelect(pWhere) );
152861 assert( pWhere->x.pSelect!=0 );
152862 pWhere->x.pSelect->selFlags |= SF_ClonedRhsIn;
152863 }
152864 #ifndef SQLITE_OMIT_WINDOWFUNC
152865 if( pSubq->pWin && 0==pushDownWindowCheck(pParse, pSubq, pNew) ){
152866 /* Restriction 6c has prevented push-down in this case */
152867 sqlite3ExprDelete(pParse->db, pNew);
152868 nChng--;
@@ -154946,10 +154977,11 @@
154977 */
154978 typedef struct CheckOnCtx CheckOnCtx;
154979 struct CheckOnCtx {
154980 SrcList *pSrc; /* SrcList for this context */
154981 int iJoin; /* Cursor numbers must be =< than this */
154982 int bFuncArg; /* True for table-function arg */
154983 CheckOnCtx *pParent; /* Parent context */
154984 };
154985
154986 /*
154987 ** True if the SrcList passed as the only argument contains at least
@@ -154997,11 +155029,13 @@
155029 SrcList *pSrc = pCtx->pSrc;
155030 int iTab = pExpr->iTable;
155031 if( iTab>=pSrc->a[0].iCursor && iTab<=pSrc->a[pSrc->nSrc-1].iCursor ){
155032 if( pCtx->iJoin && iTab>pCtx->iJoin ){
155033 sqlite3ErrorMsg(pWalker->pParse,
155034 "%s references tables to its right",
155035 (pCtx->bFuncArg ? "table-function argument" : "ON clause")
155036 );
155037 return WRC_Abort;
155038 }
155039 break;
155040 }
155041 pCtx = pCtx->pParent;
@@ -155035,21 +155069,36 @@
155069 ** columns to the right.
155070 */
155071 static void selectCheckOnClauses(Parse *pParse, Select *pSelect){
155072 Walker w;
155073 CheckOnCtx sCtx;
155074 int ii;
155075 assert( pSelect->selFlags & SF_OnToWhere );
155076 assert( pSelect->pSrc!=0 && pSelect->pSrc->nSrc>=2 );
155077 memset(&w, 0, sizeof(w));
155078 w.pParse = pParse;
155079 w.xExprCallback = selectCheckOnClausesExpr;
155080 w.xSelectCallback = selectCheckOnClausesSelect;
155081 w.u.pCheckOnCtx = &sCtx;
155082 memset(&sCtx, 0, sizeof(sCtx));
155083 sCtx.pSrc = pSelect->pSrc;
155084 sqlite3WalkExpr(&w, pSelect->pWhere);
155085 pSelect->selFlags &= ~SF_OnToWhere;
155086
155087 /* Check for any table-function args that are attached to virtual tables
155088 ** on the RHS of an outer join. They are subject to the same constraints
155089 ** as ON clauses. */
155090 sCtx.bFuncArg = 1;
155091 for(ii=0; ii<pSelect->pSrc->nSrc; ii++){
155092 SrcItem *pItem = &pSelect->pSrc->a[ii];
155093 if( pItem->fg.isTabFunc
155094 && (pItem->fg.jointype & JT_OUTER)
155095 ){
155096 sCtx.iJoin = pItem->iCursor;
155097 sqlite3WalkExprList(&w, pItem->u1.pFuncArg);
155098 }
155099 }
155100 }
155101
155102 /*
155103 ** If p2 exists and p1 and p2 have the same number of terms, then change
155104 ** every term of p1 to have the same sort order as p2 and return true.
@@ -164043,11 +164092,11 @@
164092 if( NEVER(pTerm==0) ) continue;
164093 if( pTerm->eOperator & WO_IN ){
164094 if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){
164095 int iTab = pParse->nTab++;
164096 int iCache = ++pParse->nMem;
164097 sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab, 0);
164098 sqlite3VdbeAddOp3(v, OP_VInitIn, iTab, iTarget, iCache);
164099 }else{
164100 codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);
164101 addrNotFound = pLevel->addrNxt;
164102 }
@@ -172943,16 +172992,25 @@
172992 **
172993 ** 18 for star queries
172994 ** 12 otherwise
172995 **
172996 ** For the purposes of this heuristic, a star-query is defined as a query
172997 ** with a central "fact" table that is joined against multiple
172998 ** "dimension" tables, subject to the following constraints:
172999 **
173000 ** (aa) Only a five-way or larger join is considered for this
173001 ** optimization. If there are fewer than four terms in the FROM
173002 ** clause, this heuristic does not apply.
173003 **
173004 ** (bb) The join between the fact table and the dimension tables must
173005 ** be an INNER join. CROSS and OUTER JOINs do not qualify.
173006 **
173007 ** (cc) A table must have 3 or more dimension tables in order to be
173008 ** considered a fact table. (Was 4 prior to 2026-02-10.)
173009 **
173010 ** (dd) A table that is a self-join cannot be a dimension table.
173011 ** Dimension tables are joined against fact tables.
173012 **
173013 ** SIDE EFFECT: (and really the whole point of this subroutine)
173014 **
173015 ** If pWInfo describes a star-query, then the cost for SCANs of dimension
173016 ** WhereLoops is increased to be slightly larger than the cost of a SCAN
@@ -173001,11 +173059,11 @@
173059 assert( pWLoop->maskSelf==MASKBIT(pWLoop->iTab) );
173060 assert( pWLoop->pNextLoop==0 || pWLoop->iTab<=pWLoop->pNextLoop->iTab );
173061 }
173062 #endif /* SQLITE_DEBUG */
173063
173064 if( nLoop>=4 /* Constraint (aa) */
173065 && !pWInfo->bStarDone
173066 && OptimizationEnabled(pWInfo->pParse->db, SQLITE_StarQuery)
173067 ){
173068 SrcItem *aFromTabs; /* All terms of the FROM clause */
173069 int iFromIdx; /* Term of FROM clause is the candidate fact-table */
@@ -173013,11 +173071,11 @@
173071 Bitmask mSelfJoin = 0; /* Tables that cannot be dimension tables */
173072 WhereLoop *pStart; /* Where to start searching for dimension-tables */
173073
173074 pWInfo->bStarDone = 1; /* Only do this computation once */
173075
173076 /* Look for fact tables with three or more dimensions where the
173077 ** dimension tables are not separately from the fact tables by an outer
173078 ** or cross join. Adjust cost weights if found.
173079 */
173080 assert( !pWInfo->bStarUsed );
173081 aFromTabs = pWInfo->pTabList->a;
@@ -173030,22 +173088,21 @@
173088
173089 pFactTab = aFromTabs + iFromIdx;
173090 if( (pFactTab->fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173091 /* If the candidate fact-table is the right table of an outer join
173092 ** restrict the search for dimension-tables to be tables to the right
173093 ** of the fact-table. Constraint (bb) */
173094 if( iFromIdx+3 > nLoop ){
173095 break; /* ^-- Impossible to reach nDep>=2 - Constraint (cc) */
173096 }
173097 while( pStart && pStart->iTab<=iFromIdx ){
173098 pStart = pStart->pNextLoop;
173099 }
173100 }
173101 for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
173102 if( (aFromTabs[pWLoop->iTab].fg.jointype & (JT_OUTER|JT_CROSS))!=0 ){
173103 break; /* Constraint (bb) */
 
 
 
173104 }
173105 if( (pWLoop->prereq & m)!=0 /* pWInfo depends on iFromIdx */
173106 && (pWLoop->maskSelf & mSeen)==0 /* pWInfo not already a dependency */
173107 && (pWLoop->maskSelf & mSelfJoin)==0 /* Not a self-join */
173108 ){
@@ -173055,11 +173112,13 @@
173112 nDep++;
173113 mSeen |= pWLoop->maskSelf;
173114 }
173115 }
173116 }
173117 if( nDep<=2 ){
173118 continue; /* Constraint (cc) */
173119 }
173120
173121 /* If we reach this point, it means that pFactTab is a fact table
173122 ** with four or more dimensions connected by inner joins. Proceed
173123 ** to make cost adjustments. */
173124
@@ -173068,10 +173127,27 @@
173127 if( !pWInfo->bStarUsed ){
173128 for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
173129 pWLoop->rStarDelta = 0;
173130 }
173131 }
173132 #endif
173133 #ifdef WHERETRACE_ENABLED /* 0x80000 */
173134 if( sqlite3WhereTrace & 0x80000 ){
173135 Bitmask mShow = mSeen;
173136 sqlite3DebugPrintf("Fact table %s(%d), dimensions:",
173137 pFactTab->zAlias ? pFactTab->zAlias : pFactTab->pSTab->zName,
173138 iFromIdx);
173139 for(pWLoop=pStart; pWLoop; pWLoop=pWLoop->pNextLoop){
173140 if( mShow & pWLoop->maskSelf ){
173141 SrcItem *pDim = aFromTabs + pWLoop->iTab;
173142 mShow &= ~pWLoop->maskSelf;
173143 sqlite3DebugPrintf(" %s(%d)",
173144 pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, pWLoop->iTab);
173145 }
173146 }
173147 sqlite3DebugPrintf("\n");
173148 }
173149 #endif
173150 pWInfo->bStarUsed = 1;
173151
173152 /* Compute the maximum cost of any WhereLoop for the
173153 ** fact table plus one epsilon */
@@ -173091,14 +173167,12 @@
173167 if( pWLoop->rRun<mxRun ){
173168 #ifdef WHERETRACE_ENABLED /* 0x80000 */
173169 if( sqlite3WhereTrace & 0x80000 ){
173170 SrcItem *pDim = aFromTabs + pWLoop->iTab;
173171 sqlite3DebugPrintf(
173172 "Increase SCAN cost of %s to %d\n",
173173 pDim->zAlias ? pDim->zAlias: pDim->pSTab->zName, mxRun
 
 
173174 );
173175 }
173176 pWLoop->rStarDelta = mxRun - pWLoop->rRun;
173177 #endif /* WHERETRACE_ENABLED */
173178 pWLoop->rRun = mxRun;
@@ -261473,11 +261547,11 @@
261547 int nArg, /* Number of args */
261548 sqlite3_value **apUnused /* Function arguments */
261549 ){
261550 assert( nArg==0 );
261551 UNUSED_PARAM2(nArg, apUnused);
261552 sqlite3_result_text(pCtx, "fts5: 2026-02-11 19:42:46 38d8c0d8a0b0e9990ba7bdcce979f2824ffee22a083cb788a75917628b1eb559", -1, SQLITE_TRANSIENT);
261553 }
261554
261555 /*
261556 ** Implementation of fts5_locale(LOCALE, TEXT) function.
261557 **
261558
--- 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.52.0"
150150
#define SQLITE_VERSION_NUMBER 3052000
151
-#define SQLITE_SOURCE_ID "2026-02-04 20:51:27 c476d956d0bd3065cf894de6f9d393b999ff7d2268a35f01a6d88804789ab58f"
151
+#define SQLITE_SOURCE_ID "2026-02-10 19:33:11 b67889e4f17c3280f839ee7045256cc47d6ce3ed60d880925e3d30f9ebbcf3ff"
152152
#define SQLITE_SCM_BRANCH "trunk"
153153
#define SQLITE_SCM_TAGS ""
154
-#define SQLITE_SCM_DATETIME "2026-02-04T20:51:27.822Z"
154
+#define SQLITE_SCM_DATETIME "2026-02-10T19:33:11.305Z"
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.52.0"
150 #define SQLITE_VERSION_NUMBER 3052000
151 #define SQLITE_SOURCE_ID "2026-02-04 20:51:27 c476d956d0bd3065cf894de6f9d393b999ff7d2268a35f01a6d88804789ab58f"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-02-04T20:51:27.822Z"
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.52.0"
150 #define SQLITE_VERSION_NUMBER 3052000
151 #define SQLITE_SOURCE_ID "2026-02-10 19:33:11 b67889e4f17c3280f839ee7045256cc47d6ce3ed60d880925e3d30f9ebbcf3ff"
152 #define SQLITE_SCM_BRANCH "trunk"
153 #define SQLITE_SCM_TAGS ""
154 #define SQLITE_SCM_DATETIME "2026-02-10T19:33:11.305Z"
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