Fossil SCM

Update the built-in SQLite to the first 3.41.2 beta, for testing.

drh 2023-03-17 12:28 trunk
Commit 36b17e515a5dc74ecba20348ce42eb7ea0f4ad5dfc689247d55b467ecbc26c6a
+1 -2
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -13259,12 +13259,11 @@
1325913259
static int dbdataGetEncoding(DbdataCursor *pCsr){
1326013260
int rc = SQLITE_OK;
1326113261
int nPg1 = 0;
1326213262
u8 *aPg1 = 0;
1326313263
rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13264
- assert( rc!=SQLITE_OK || nPg1==0 || nPg1>=512 );
13265
- if( rc==SQLITE_OK && nPg1>0 ){
13264
+ if( rc==SQLITE_OK && nPg1>=(56+4) ){
1326613265
pCsr->enc = get_uint32(&aPg1[56]);
1326713266
}
1326813267
sqlite3_free(aPg1);
1326913268
return rc;
1327013269
}
1327113270
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -13259,12 +13259,11 @@
13259 static int dbdataGetEncoding(DbdataCursor *pCsr){
13260 int rc = SQLITE_OK;
13261 int nPg1 = 0;
13262 u8 *aPg1 = 0;
13263 rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13264 assert( rc!=SQLITE_OK || nPg1==0 || nPg1>=512 );
13265 if( rc==SQLITE_OK && nPg1>0 ){
13266 pCsr->enc = get_uint32(&aPg1[56]);
13267 }
13268 sqlite3_free(aPg1);
13269 return rc;
13270 }
13271
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -13259,12 +13259,11 @@
13259 static int dbdataGetEncoding(DbdataCursor *pCsr){
13260 int rc = SQLITE_OK;
13261 int nPg1 = 0;
13262 u8 *aPg1 = 0;
13263 rc = dbdataLoadPage(pCsr, 1, &aPg1, &nPg1);
13264 if( rc==SQLITE_OK && nPg1>=(56+4) ){
 
13265 pCsr->enc = get_uint32(&aPg1[56]);
13266 }
13267 sqlite3_free(aPg1);
13268 return rc;
13269 }
13270
+47 -19
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.41.1. By combining all the individual C code files into this
3
+** version 3.41.2. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -450,13 +450,13 @@
450450
**
451451
** See also: [sqlite3_libversion()],
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455
-#define SQLITE_VERSION "3.41.1"
456
-#define SQLITE_VERSION_NUMBER 3041001
457
-#define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
455
+#define SQLITE_VERSION "3.41.2"
456
+#define SQLITE_VERSION_NUMBER 3041002
457
+#define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -18835,11 +18835,11 @@
1883518835
#define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
1883618836
#define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
1883718837
#define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
1883818838
#define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
1883918839
#define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18840
-#define NC_VarSelect 0x000040 /* A correlated subquery has been seen */
18840
+#define NC_Subquery 0x000040 /* A subquery has been seen */
1884118841
#define NC_UEList 0x000080 /* True if uNC.pEList is used */
1884218842
#define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
1884318843
#define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
1884418844
#define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
1884518845
#define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19207,13 @@
1920719207
u8 prepFlags; /* SQLITE_PREPARE_* flags */
1920819208
u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
1920919209
#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
1921019210
u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
1921119211
#endif
19212
+#ifdef SQLITE_DEBUG
19213
+ u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
19214
+#endif
1921219215
int nRangeReg; /* Size of the temporary register block */
1921319216
int iRangeReg; /* First register in temporary register block */
1921419217
int nErr; /* Number of errors seen */
1921519218
int nTab; /* Number of previously allocated VDBE cursors */
1921619219
int nMem; /* Number of memory cells used so far */
@@ -74503,11 +74506,11 @@
7450374506
}
7450474507
}
7450574508
7450674509
pPage = pCur->pPage;
7450774510
idx = ++pCur->ix;
74508
- if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
74511
+ if( !pPage->isInit || sqlite3FaultSim(412) ){
7450974512
return SQLITE_CORRUPT_BKPT;
7451074513
}
7451174514
7451274515
if( idx>=pPage->nCell ){
7451374516
if( !pPage->leaf ){
@@ -104798,12 +104801,12 @@
104798104801
sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104799104802
}
104800104803
assert( pNC->nRef>=nRef );
104801104804
if( nRef!=pNC->nRef ){
104802104805
ExprSetProperty(pExpr, EP_VarSelect);
104803
- pNC->ncFlags |= NC_VarSelect;
104804104806
}
104807
+ pNC->ncFlags |= NC_Subquery;
104805104808
}
104806104809
break;
104807104810
}
104808104811
case TK_VARIABLE: {
104809104812
testcase( pNC->ncFlags & NC_IsCheck );
@@ -109576,10 +109579,11 @@
109576109579
int regOut /* Extract the value into this register */
109577109580
){
109578109581
Column *pCol;
109579109582
assert( v!=0 );
109580109583
assert( pTab!=0 );
109584
+ assert( iCol!=XN_EXPR );
109581109585
if( iCol<0 || iCol==pTab->iPKey ){
109582109586
sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109583109587
VdbeComment((v, "%s.rowid", pTab->zName));
109584109588
}else{
109585109589
int op;
@@ -118931,11 +118935,11 @@
118931118935
Hash *pHash;
118932118936
sqlite3 *db = pParse->db;
118933118937
if( pParse->pNewTrigger ){
118934118938
sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118935118939
}else{
118936
- assert( pParse->bReturning==0 );
118940
+ assert( pParse->bReturning==0 || pParse->ifNotExists );
118937118941
}
118938118942
pParse->bReturning = 1;
118939118943
pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118940118944
if( pRet==0 ){
118941118945
sqlite3ExprListDelete(db, pList);
@@ -118957,11 +118961,12 @@
118957118961
pRet->retTrig.step_list = &pRet->retTStep;
118958118962
pRet->retTStep.op = TK_RETURNING;
118959118963
pRet->retTStep.pTrig = &pRet->retTrig;
118960118964
pRet->retTStep.pExprList = pList;
118961118965
pHash = &(db->aDb[1].pSchema->trigHash);
118962
- assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
118966
+ assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
118967
+ || pParse->nErr || pParse->ifNotExists );
118963118968
if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118964118969
==&pRet->retTrig ){
118965118970
sqlite3OomFault(db);
118966118971
}
118967118972
}
@@ -124199,11 +124204,11 @@
124199124204
}
124200124205
}else
124201124206
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124202124207
{
124203124208
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124204
- if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124209
+ if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
124205124210
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124206124211
if( HasRowid(pTab) ){
124207124212
/* For a rowid table, initialize the RowSet to an empty set */
124208124213
pPk = 0;
124209124214
nPk = 1;
@@ -142129,11 +142134,13 @@
142129142134
assert( pExpr->pRight==0 );
142130142135
if( sqlite3ExprIsVector(pCopy) ){
142131142136
sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142132142137
}else{
142133142138
sqlite3 *db = pSubst->pParse->db;
142134
- if( pSubst->isOuterJoin ){
142139
+ if( pSubst->isOuterJoin
142140
+ && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
142141
+ ){
142135142142
memset(&ifNullRow, 0, sizeof(ifNullRow));
142136142143
ifNullRow.op = TK_IF_NULL_ROW;
142137142144
ifNullRow.pLeft = pCopy;
142138142145
ifNullRow.iTable = pSubst->iNewTable;
142139142146
ifNullRow.iColumn = -99;
@@ -146891,10 +146898,11 @@
146891146898
if( !noErr ){
146892146899
sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146893146900
}else{
146894146901
assert( !db->init.busy );
146895146902
sqlite3CodeVerifySchema(pParse, iDb);
146903
+ VVA_ONLY( pParse->ifNotExists = 1; )
146896146904
}
146897146905
goto trigger_cleanup;
146898146906
}
146899146907
}
146900146908
@@ -148894,16 +148902,26 @@
148894148902
bFinishSeek = 0;
148895148903
}else{
148896148904
/* Begin the database scan.
148897148905
**
148898148906
** Do not consider a single-pass strategy for a multi-row update if
148899
- ** there are any triggers or foreign keys to process, or rows may
148900
- ** be deleted as a result of REPLACE conflict handling. Any of these
148901
- ** things might disturb a cursor being used to scan through the table
148902
- ** or index, causing a single-pass approach to malfunction. */
148907
+ ** there is anything that might disrupt the cursor being used to do
148908
+ ** the UPDATE:
148909
+ ** (1) This is a nested UPDATE
148910
+ ** (2) There are triggers
148911
+ ** (3) There are FOREIGN KEY constraints
148912
+ ** (4) There are REPLACE conflict handlers
148913
+ ** (5) There are subqueries in the WHERE clause
148914
+ */
148903148915
flags = WHERE_ONEPASS_DESIRED;
148904
- if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
148916
+ if( !pParse->nested
148917
+ && !pTrigger
148918
+ && !hasFK
148919
+ && !chngKey
148920
+ && !bReplace
148921
+ && (sNC.ncFlags & NC_Subquery)==0
148922
+ ){
148905148923
flags |= WHERE_ONEPASS_MULTIROW;
148906148924
}
148907148925
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148908148926
if( pWInfo==0 ) goto update_cleanup;
148909148927
@@ -150864,11 +150882,13 @@
150864150882
sCtx.pTab = pTab;
150865150883
sCtx.pVTable = pVTable;
150866150884
sCtx.pPrior = db->pVtabCtx;
150867150885
sCtx.bDeclared = 0;
150868150886
db->pVtabCtx = &sCtx;
150887
+ pTab->nTabRef++;
150869150888
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
150889
+ sqlite3DeleteTable(db, pTab);
150870150890
db->pVtabCtx = sCtx.pPrior;
150871150891
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150872150892
assert( sCtx.pTab==pTab );
150873150893
150874150894
if( SQLITE_OK!=rc ){
@@ -158033,10 +158053,14 @@
158033158053
const WhereTerm *pWCEnd; /* Last WHERE clause term */
158034158054
Parse *pParse = pWInfo->pParse; /* Parsing context */
158035158055
Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158036158056
WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158037158057
int iCur; /* Cursor for table getting the filter */
158058
+ IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */
158059
+
158060
+ saved_pIdxEpr = pParse->pIdxEpr;
158061
+ pParse->pIdxEpr = 0;
158038158062
158039158063
assert( pLoop!=0 );
158040158064
assert( v!=0 );
158041158065
assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158042158066
@@ -158089,13 +158113,12 @@
158089158113
Index *pIdx = pLoop->u.btree.pIndex;
158090158114
int n = pLoop->u.btree.nEq;
158091158115
int r1 = sqlite3GetTempRange(pParse, n);
158092158116
int jj;
158093158117
for(jj=0; jj<n; jj++){
158094
- int iCol = pIdx->aiColumn[jj];
158095158118
assert( pIdx->pTable==pItem->pTab );
158096
- sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158119
+ sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
158097158120
}
158098158121
sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158099158122
sqlite3ReleaseTempRange(pParse, r1, n);
158100158123
}
158101158124
sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158145,11 @@
158122158145
break;
158123158146
}
158124158147
}
158125158148
}while( iLevel < pWInfo->nLevel );
158126158149
sqlite3VdbeJumpHere(v, addrOnce);
158150
+ pParse->pIdxEpr = saved_pIdxEpr;
158127158151
}
158128158152
158129158153
158130158154
#ifndef SQLITE_OMIT_VIRTUALTABLE
158131158155
/*
@@ -162193,10 +162217,14 @@
162193162217
pWInfo->nOBSat = pFrom->isOrdered;
162194162218
if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162195162219
if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162196162220
pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162197162221
}
162222
+ if( pWInfo->pSelect->pOrderBy
162223
+ && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
162224
+ pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
162225
+ }
162198162226
}else{
162199162227
pWInfo->revMask = pFrom->revLoop;
162200162228
if( pWInfo->nOBSat<=0 ){
162201162229
pWInfo->nOBSat = 0;
162202162230
if( nLoop>0 ){
@@ -240222,11 +240250,11 @@
240222240250
int nArg, /* Number of args */
240223240251
sqlite3_value **apUnused /* Function arguments */
240224240252
){
240225240253
assert( nArg==0 );
240226240254
UNUSED_PARAM2(nArg, apUnused);
240227
- sqlite3_result_text(pCtx, "fts5: 2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730", -1, SQLITE_TRANSIENT);
240255
+ sqlite3_result_text(pCtx, "fts5: 2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba", -1, SQLITE_TRANSIENT);
240228240256
}
240229240257
240230240258
/*
240231240259
** Return true if zName is the extension on one of the shadow tables used
240232240260
** by this module.
240233240261
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.41.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.41.1"
456 #define SQLITE_VERSION_NUMBER 3041001
457 #define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -18835,11 +18835,11 @@
18835 #define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
18836 #define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
18837 #define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
18838 #define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
18839 #define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18840 #define NC_VarSelect 0x000040 /* A correlated subquery has been seen */
18841 #define NC_UEList 0x000080 /* True if uNC.pEList is used */
18842 #define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
18843 #define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
18844 #define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
18845 #define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19207,13 @@
19207 u8 prepFlags; /* SQLITE_PREPARE_* flags */
19208 u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
19209 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
19210 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
19211 #endif
 
 
 
19212 int nRangeReg; /* Size of the temporary register block */
19213 int iRangeReg; /* First register in temporary register block */
19214 int nErr; /* Number of errors seen */
19215 int nTab; /* Number of previously allocated VDBE cursors */
19216 int nMem; /* Number of memory cells used so far */
@@ -74503,11 +74506,11 @@
74503 }
74504 }
74505
74506 pPage = pCur->pPage;
74507 idx = ++pCur->ix;
74508 if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){
74509 return SQLITE_CORRUPT_BKPT;
74510 }
74511
74512 if( idx>=pPage->nCell ){
74513 if( !pPage->leaf ){
@@ -104798,12 +104801,12 @@
104798 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104799 }
104800 assert( pNC->nRef>=nRef );
104801 if( nRef!=pNC->nRef ){
104802 ExprSetProperty(pExpr, EP_VarSelect);
104803 pNC->ncFlags |= NC_VarSelect;
104804 }
 
104805 }
104806 break;
104807 }
104808 case TK_VARIABLE: {
104809 testcase( pNC->ncFlags & NC_IsCheck );
@@ -109576,10 +109579,11 @@
109576 int regOut /* Extract the value into this register */
109577 ){
109578 Column *pCol;
109579 assert( v!=0 );
109580 assert( pTab!=0 );
 
109581 if( iCol<0 || iCol==pTab->iPKey ){
109582 sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109583 VdbeComment((v, "%s.rowid", pTab->zName));
109584 }else{
109585 int op;
@@ -118931,11 +118935,11 @@
118931 Hash *pHash;
118932 sqlite3 *db = pParse->db;
118933 if( pParse->pNewTrigger ){
118934 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118935 }else{
118936 assert( pParse->bReturning==0 );
118937 }
118938 pParse->bReturning = 1;
118939 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118940 if( pRet==0 ){
118941 sqlite3ExprListDelete(db, pList);
@@ -118957,11 +118961,12 @@
118957 pRet->retTrig.step_list = &pRet->retTStep;
118958 pRet->retTStep.op = TK_RETURNING;
118959 pRet->retTStep.pTrig = &pRet->retTrig;
118960 pRet->retTStep.pExprList = pList;
118961 pHash = &(db->aDb[1].pSchema->trigHash);
118962 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr );
 
118963 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118964 ==&pRet->retTrig ){
118965 sqlite3OomFault(db);
118966 }
118967 }
@@ -124199,11 +124204,11 @@
124199 }
124200 }else
124201 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124202 {
124203 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124204 if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
124205 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124206 if( HasRowid(pTab) ){
124207 /* For a rowid table, initialize the RowSet to an empty set */
124208 pPk = 0;
124209 nPk = 1;
@@ -142129,11 +142134,13 @@
142129 assert( pExpr->pRight==0 );
142130 if( sqlite3ExprIsVector(pCopy) ){
142131 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142132 }else{
142133 sqlite3 *db = pSubst->pParse->db;
142134 if( pSubst->isOuterJoin ){
 
 
142135 memset(&ifNullRow, 0, sizeof(ifNullRow));
142136 ifNullRow.op = TK_IF_NULL_ROW;
142137 ifNullRow.pLeft = pCopy;
142138 ifNullRow.iTable = pSubst->iNewTable;
142139 ifNullRow.iColumn = -99;
@@ -146891,10 +146898,11 @@
146891 if( !noErr ){
146892 sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146893 }else{
146894 assert( !db->init.busy );
146895 sqlite3CodeVerifySchema(pParse, iDb);
 
146896 }
146897 goto trigger_cleanup;
146898 }
146899 }
146900
@@ -148894,16 +148902,26 @@
148894 bFinishSeek = 0;
148895 }else{
148896 /* Begin the database scan.
148897 **
148898 ** Do not consider a single-pass strategy for a multi-row update if
148899 ** there are any triggers or foreign keys to process, or rows may
148900 ** be deleted as a result of REPLACE conflict handling. Any of these
148901 ** things might disturb a cursor being used to scan through the table
148902 ** or index, causing a single-pass approach to malfunction. */
 
 
 
 
148903 flags = WHERE_ONEPASS_DESIRED;
148904 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
 
 
 
 
 
 
148905 flags |= WHERE_ONEPASS_MULTIROW;
148906 }
148907 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148908 if( pWInfo==0 ) goto update_cleanup;
148909
@@ -150864,11 +150882,13 @@
150864 sCtx.pTab = pTab;
150865 sCtx.pVTable = pVTable;
150866 sCtx.pPrior = db->pVtabCtx;
150867 sCtx.bDeclared = 0;
150868 db->pVtabCtx = &sCtx;
 
150869 rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
 
150870 db->pVtabCtx = sCtx.pPrior;
150871 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150872 assert( sCtx.pTab==pTab );
150873
150874 if( SQLITE_OK!=rc ){
@@ -158033,10 +158053,14 @@
158033 const WhereTerm *pWCEnd; /* Last WHERE clause term */
158034 Parse *pParse = pWInfo->pParse; /* Parsing context */
158035 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158036 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158037 int iCur; /* Cursor for table getting the filter */
 
 
 
 
158038
158039 assert( pLoop!=0 );
158040 assert( v!=0 );
158041 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158042
@@ -158089,13 +158113,12 @@
158089 Index *pIdx = pLoop->u.btree.pIndex;
158090 int n = pLoop->u.btree.nEq;
158091 int r1 = sqlite3GetTempRange(pParse, n);
158092 int jj;
158093 for(jj=0; jj<n; jj++){
158094 int iCol = pIdx->aiColumn[jj];
158095 assert( pIdx->pTable==pItem->pTab );
158096 sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
158097 }
158098 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158099 sqlite3ReleaseTempRange(pParse, r1, n);
158100 }
158101 sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158145,11 @@
158122 break;
158123 }
158124 }
158125 }while( iLevel < pWInfo->nLevel );
158126 sqlite3VdbeJumpHere(v, addrOnce);
 
158127 }
158128
158129
158130 #ifndef SQLITE_OMIT_VIRTUALTABLE
158131 /*
@@ -162193,10 +162217,14 @@
162193 pWInfo->nOBSat = pFrom->isOrdered;
162194 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162195 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162196 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162197 }
 
 
 
 
162198 }else{
162199 pWInfo->revMask = pFrom->revLoop;
162200 if( pWInfo->nOBSat<=0 ){
162201 pWInfo->nOBSat = 0;
162202 if( nLoop>0 ){
@@ -240222,11 +240250,11 @@
240222 int nArg, /* Number of args */
240223 sqlite3_value **apUnused /* Function arguments */
240224 ){
240225 assert( nArg==0 );
240226 UNUSED_PARAM2(nArg, apUnused);
240227 sqlite3_result_text(pCtx, "fts5: 2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730", -1, SQLITE_TRANSIENT);
240228 }
240229
240230 /*
240231 ** Return true if zName is the extension on one of the shadow tables used
240232 ** by this module.
240233
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.41.2. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.41.2"
456 #define SQLITE_VERSION_NUMBER 3041002
457 #define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -18835,11 +18835,11 @@
18835 #define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */
18836 #define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */
18837 #define NC_HasAgg 0x000010 /* One or more aggregate functions seen */
18838 #define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */
18839 #define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */
18840 #define NC_Subquery 0x000040 /* A subquery has been seen */
18841 #define NC_UEList 0x000080 /* True if uNC.pEList is used */
18842 #define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */
18843 #define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */
18844 #define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */
18845 #define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */
@@ -19207,10 +19207,13 @@
19207 u8 prepFlags; /* SQLITE_PREPARE_* flags */
19208 u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */
19209 #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)
19210 u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */
19211 #endif
19212 #ifdef SQLITE_DEBUG
19213 u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */
19214 #endif
19215 int nRangeReg; /* Size of the temporary register block */
19216 int iRangeReg; /* First register in temporary register block */
19217 int nErr; /* Number of errors seen */
19218 int nTab; /* Number of previously allocated VDBE cursors */
19219 int nMem; /* Number of memory cells used so far */
@@ -74503,11 +74506,11 @@
74506 }
74507 }
74508
74509 pPage = pCur->pPage;
74510 idx = ++pCur->ix;
74511 if( !pPage->isInit || sqlite3FaultSim(412) ){
74512 return SQLITE_CORRUPT_BKPT;
74513 }
74514
74515 if( idx>=pPage->nCell ){
74516 if( !pPage->leaf ){
@@ -104798,12 +104801,12 @@
104801 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
104802 }
104803 assert( pNC->nRef>=nRef );
104804 if( nRef!=pNC->nRef ){
104805 ExprSetProperty(pExpr, EP_VarSelect);
 
104806 }
104807 pNC->ncFlags |= NC_Subquery;
104808 }
104809 break;
104810 }
104811 case TK_VARIABLE: {
104812 testcase( pNC->ncFlags & NC_IsCheck );
@@ -109576,10 +109579,11 @@
109579 int regOut /* Extract the value into this register */
109580 ){
109581 Column *pCol;
109582 assert( v!=0 );
109583 assert( pTab!=0 );
109584 assert( iCol!=XN_EXPR );
109585 if( iCol<0 || iCol==pTab->iPKey ){
109586 sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);
109587 VdbeComment((v, "%s.rowid", pTab->zName));
109588 }else{
109589 int op;
@@ -118931,11 +118935,11 @@
118935 Hash *pHash;
118936 sqlite3 *db = pParse->db;
118937 if( pParse->pNewTrigger ){
118938 sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger");
118939 }else{
118940 assert( pParse->bReturning==0 || pParse->ifNotExists );
118941 }
118942 pParse->bReturning = 1;
118943 pRet = sqlite3DbMallocZero(db, sizeof(*pRet));
118944 if( pRet==0 ){
118945 sqlite3ExprListDelete(db, pList);
@@ -118957,11 +118961,12 @@
118961 pRet->retTrig.step_list = &pRet->retTStep;
118962 pRet->retTStep.op = TK_RETURNING;
118963 pRet->retTStep.pTrig = &pRet->retTrig;
118964 pRet->retTStep.pExprList = pList;
118965 pHash = &(db->aDb[1].pSchema->trigHash);
118966 assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0
118967 || pParse->nErr || pParse->ifNotExists );
118968 if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig)
118969 ==&pRet->retTrig ){
118970 sqlite3OomFault(db);
118971 }
118972 }
@@ -124199,11 +124204,11 @@
124204 }
124205 }else
124206 #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
124207 {
124208 u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
124209 if( sNC.ncFlags & NC_Subquery ) bComplex = 1;
124210 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
124211 if( HasRowid(pTab) ){
124212 /* For a rowid table, initialize the RowSet to an empty set */
124213 pPk = 0;
124214 nPk = 1;
@@ -142129,11 +142134,13 @@
142134 assert( pExpr->pRight==0 );
142135 if( sqlite3ExprIsVector(pCopy) ){
142136 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
142137 }else{
142138 sqlite3 *db = pSubst->pParse->db;
142139 if( pSubst->isOuterJoin
142140 && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable)
142141 ){
142142 memset(&ifNullRow, 0, sizeof(ifNullRow));
142143 ifNullRow.op = TK_IF_NULL_ROW;
142144 ifNullRow.pLeft = pCopy;
142145 ifNullRow.iTable = pSubst->iNewTable;
142146 ifNullRow.iColumn = -99;
@@ -146891,10 +146898,11 @@
146898 if( !noErr ){
146899 sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
146900 }else{
146901 assert( !db->init.busy );
146902 sqlite3CodeVerifySchema(pParse, iDb);
146903 VVA_ONLY( pParse->ifNotExists = 1; )
146904 }
146905 goto trigger_cleanup;
146906 }
146907 }
146908
@@ -148894,16 +148902,26 @@
148902 bFinishSeek = 0;
148903 }else{
148904 /* Begin the database scan.
148905 **
148906 ** Do not consider a single-pass strategy for a multi-row update if
148907 ** there is anything that might disrupt the cursor being used to do
148908 ** the UPDATE:
148909 ** (1) This is a nested UPDATE
148910 ** (2) There are triggers
148911 ** (3) There are FOREIGN KEY constraints
148912 ** (4) There are REPLACE conflict handlers
148913 ** (5) There are subqueries in the WHERE clause
148914 */
148915 flags = WHERE_ONEPASS_DESIRED;
148916 if( !pParse->nested
148917 && !pTrigger
148918 && !hasFK
148919 && !chngKey
148920 && !bReplace
148921 && (sNC.ncFlags & NC_Subquery)==0
148922 ){
148923 flags |= WHERE_ONEPASS_MULTIROW;
148924 }
148925 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur);
148926 if( pWInfo==0 ) goto update_cleanup;
148927
@@ -150864,11 +150882,13 @@
150882 sCtx.pTab = pTab;
150883 sCtx.pVTable = pVTable;
150884 sCtx.pPrior = db->pVtabCtx;
150885 sCtx.bDeclared = 0;
150886 db->pVtabCtx = &sCtx;
150887 pTab->nTabRef++;
150888 rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
150889 sqlite3DeleteTable(db, pTab);
150890 db->pVtabCtx = sCtx.pPrior;
150891 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
150892 assert( sCtx.pTab==pTab );
150893
150894 if( SQLITE_OK!=rc ){
@@ -158033,10 +158053,14 @@
158053 const WhereTerm *pWCEnd; /* Last WHERE clause term */
158054 Parse *pParse = pWInfo->pParse; /* Parsing context */
158055 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
158056 WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
158057 int iCur; /* Cursor for table getting the filter */
158058 IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */
158059
158060 saved_pIdxEpr = pParse->pIdxEpr;
158061 pParse->pIdxEpr = 0;
158062
158063 assert( pLoop!=0 );
158064 assert( v!=0 );
158065 assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
158066
@@ -158089,13 +158113,12 @@
158113 Index *pIdx = pLoop->u.btree.pIndex;
158114 int n = pLoop->u.btree.nEq;
158115 int r1 = sqlite3GetTempRange(pParse, n);
158116 int jj;
158117 for(jj=0; jj<n; jj++){
 
158118 assert( pIdx->pTable==pItem->pTab );
158119 sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj);
158120 }
158121 sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
158122 sqlite3ReleaseTempRange(pParse, r1, n);
158123 }
158124 sqlite3VdbeResolveLabel(v, addrCont);
@@ -158122,10 +158145,11 @@
158145 break;
158146 }
158147 }
158148 }while( iLevel < pWInfo->nLevel );
158149 sqlite3VdbeJumpHere(v, addrOnce);
158150 pParse->pIdxEpr = saved_pIdxEpr;
158151 }
158152
158153
158154 #ifndef SQLITE_OMIT_VIRTUALTABLE
158155 /*
@@ -162193,10 +162217,14 @@
162217 pWInfo->nOBSat = pFrom->isOrdered;
162218 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
162219 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
162220 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
162221 }
162222 if( pWInfo->pSelect->pOrderBy
162223 && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){
162224 pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr;
162225 }
162226 }else{
162227 pWInfo->revMask = pFrom->revLoop;
162228 if( pWInfo->nOBSat<=0 ){
162229 pWInfo->nOBSat = 0;
162230 if( nLoop>0 ){
@@ -240222,11 +240250,11 @@
240250 int nArg, /* Number of args */
240251 sqlite3_value **apUnused /* Function arguments */
240252 ){
240253 assert( nArg==0 );
240254 UNUSED_PARAM2(nArg, apUnused);
240255 sqlite3_result_text(pCtx, "fts5: 2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba", -1, SQLITE_TRANSIENT);
240256 }
240257
240258 /*
240259 ** Return true if zName is the extension on one of the shadow tables used
240260 ** by this module.
240261
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144144
**
145145
** See also: [sqlite3_libversion()],
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149
-#define SQLITE_VERSION "3.41.1"
150
-#define SQLITE_VERSION_NUMBER 3041001
151
-#define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
149
+#define SQLITE_VERSION "3.41.2"
150
+#define SQLITE_VERSION_NUMBER 3041002
151
+#define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.41.1"
150 #define SQLITE_VERSION_NUMBER 3041001
151 #define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.41.2"
150 #define SQLITE_VERSION_NUMBER 3041002
151 #define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157

Keyboard Shortcuts

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