aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/sqlite3
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.ru>2022-05-07 09:40:52 +0300
committerrobot-contrib <robot-contrib@yandex-team.ru>2022-05-07 09:40:52 +0300
commitdd4236474cdb0d827be187b379221fa85e6f2bc9 (patch)
tree155608039a1e93439a08885369f5b2488d2bbf30 /contrib/libs/sqlite3
parent51f5fb2eb5cfdcfb2e2e78456a8397dacfb196f1 (diff)
downloadydb-dd4236474cdb0d827be187b379221fa85e6f2bc9.tar.gz
Update contrib/libs/sqlite3 to 3.38.5
ref:741762330d498cb7321c19a4c8b749266cb8587d
Diffstat (limited to 'contrib/libs/sqlite3')
-rw-r--r--contrib/libs/sqlite3/.yandex_meta/devtools.licenses.report258
-rw-r--r--contrib/libs/sqlite3/config.h4
-rw-r--r--contrib/libs/sqlite3/sqlite3.c144
-rw-r--r--contrib/libs/sqlite3/sqlite3.h6
4 files changed, 245 insertions, 167 deletions
diff --git a/contrib/libs/sqlite3/.yandex_meta/devtools.licenses.report b/contrib/libs/sqlite3/.yandex_meta/devtools.licenses.report
index 528c9a3014..68d3e579a0 100644
--- a/contrib/libs/sqlite3/.yandex_meta/devtools.licenses.report
+++ b/contrib/libs/sqlite3/.yandex_meta/devtools.licenses.report
@@ -39,7 +39,7 @@ BELONGS ya.make
Match type : TEXT
Links : http://www.linfo.org/publicdomain.html, https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/public-domain.LICENSE
Files with this license:
- sqlite3.c [173994:173994]
+ sqlite3.c [174048:174048]
SKIP LicenseRef-scancode-proprietary-license 8426a059ede424b00bf0246f20b5d31f
BELONGS ya.make
@@ -52,7 +52,7 @@ BELONGS ya.make
Match type : REFERENCE
Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/proprietary-license.LICENSE
Files with this license:
- sqlite3.c [65533:65533]
+ sqlite3.c [65535:65535]
KEEP blessing 85b808eb169d4456ed67e0cf819b320f
BELONGS ya.make
@@ -78,132 +78,132 @@ BELONGS ya.make
sqlite3.c [16172:16177]
sqlite3.c [16200:16205]
sqlite3.c [16456:16461]
- sqlite3.c [20621:20626]
- sqlite3.c [20664:20669]
- sqlite3.c [20826:20831]
- sqlite3.c [21608:21613]
- sqlite3.c [22015:22020]
- sqlite3.c [22033:22038]
- sqlite3.c [23066:23071]
- sqlite3.c [24426:24431]
- sqlite3.c [24873:24878]
- sqlite3.c [24963:24968]
- sqlite3.c [25025:25030]
- sqlite3.c [25319:25324]
- sqlite3.c [25850:25855]
- sqlite3.c [26540:26545]
- sqlite3.c [27119:27124]
- sqlite3.c [27483:27488]
- sqlite3.c [27702:27707]
- sqlite3.c [28099:28104]
- sqlite3.c [28125:28130]
- sqlite3.c [28593:28598]
- sqlite3.c [30816:30821]
- sqlite3.c [31636:31641]
- sqlite3.c [31778:31783]
- sqlite3.c [32055:32060]
- sqlite3.c [32593:32598]
- sqlite3.c [34311:34316]
- sqlite3.c [34787:34792]
- sqlite3.c [42925:42930]
- sqlite3.c [49086:49091]
- sqlite3.c [49967:49972]
- sqlite3.c [50381:50386]
- sqlite3.c [51270:51275]
- sqlite3.c [52557:52562]
- sqlite3.c [53062:53067]
- sqlite3.c [53086:53091]
- sqlite3.c [60957:60962]
- sqlite3.c [65115:65120]
- sqlite3.c [65134:65139]
- sqlite3.c [66161:66166]
- sqlite3.c [77081:77086]
- sqlite3.c [77854:77859]
- sqlite3.c [79800:79805]
- sqlite3.c [85062:85067]
- sqlite3.c [87203:87208]
- sqlite3.c [87398:87403]
- sqlite3.c [96006:96011]
- sqlite3.c [96525:96530]
- sqlite3.c [99294:99299]
- sqlite3.c [99721:99726]
- sqlite3.c [100162:100167]
- sqlite3.c [100422:100427]
- sqlite3.c [102481:102486]
- sqlite3.c [108834:108839]
- sqlite3.c [111097:111102]
- sqlite3.c [113030:113035]
- sqlite3.c [113631:113636]
- sqlite3.c [113902:113907]
- sqlite3.c [119546:119551]
- sqlite3.c [120086:120091]
- sqlite3.c [121071:121076]
- sqlite3.c [123457:123462]
- sqlite3.c [124936:124941]
- sqlite3.c [128067:128072]
- sqlite3.c [128211:128216]
- sqlite3.c [128231:128236]
- sqlite3.c [129783:129788]
- sqlite3.c [133169:133174]
- sqlite3.c [134226:134231]
- sqlite3.c [141778:141783]
- sqlite3.c [141978:141983]
- sqlite3.c [143410:143415]
- sqlite3.c [144750:144755]
- sqlite3.c [145068:145073]
- sqlite3.c [145477:145482]
- sqlite3.c [146824:146829]
- sqlite3.c [146846:146851]
- sqlite3.c [150168:150173]
- sqlite3.c [152008:152013]
- sqlite3.c [158247:158252]
- sqlite3.c [161357:161362]
- sqlite3.c [166767:166772]
- sqlite3.c [168108:168113]
- sqlite3.c [168401:168406]
- sqlite3.c [168422:168427]
+ sqlite3.c [20622:20627]
+ sqlite3.c [20665:20670]
+ sqlite3.c [20827:20832]
+ sqlite3.c [21609:21614]
+ sqlite3.c [22016:22021]
+ sqlite3.c [22034:22039]
+ sqlite3.c [23067:23072]
+ sqlite3.c [24427:24432]
+ sqlite3.c [24874:24879]
+ sqlite3.c [24964:24969]
+ sqlite3.c [25026:25031]
+ sqlite3.c [25320:25325]
+ sqlite3.c [25851:25856]
+ sqlite3.c [26541:26546]
+ sqlite3.c [27120:27125]
+ sqlite3.c [27484:27489]
+ sqlite3.c [27703:27708]
+ sqlite3.c [28100:28105]
+ sqlite3.c [28126:28131]
+ sqlite3.c [28594:28599]
+ sqlite3.c [30818:30823]
+ sqlite3.c [31638:31643]
+ sqlite3.c [31780:31785]
+ sqlite3.c [32057:32062]
+ sqlite3.c [32595:32600]
+ sqlite3.c [34313:34318]
+ sqlite3.c [34789:34794]
+ sqlite3.c [42927:42932]
+ sqlite3.c [49088:49093]
+ sqlite3.c [49969:49974]
+ sqlite3.c [50383:50388]
+ sqlite3.c [51272:51277]
+ sqlite3.c [52559:52564]
+ sqlite3.c [53064:53069]
+ sqlite3.c [53088:53093]
+ sqlite3.c [60959:60964]
+ sqlite3.c [65117:65122]
+ sqlite3.c [65136:65141]
+ sqlite3.c [66163:66168]
+ sqlite3.c [77085:77090]
+ sqlite3.c [77858:77863]
+ sqlite3.c [79808:79813]
+ sqlite3.c [85070:85075]
+ sqlite3.c [87211:87216]
+ sqlite3.c [87406:87411]
+ sqlite3.c [96016:96021]
+ sqlite3.c [96535:96540]
+ sqlite3.c [99304:99309]
+ sqlite3.c [99731:99736]
+ sqlite3.c [100172:100177]
+ sqlite3.c [100432:100437]
+ sqlite3.c [102491:102496]
+ sqlite3.c [108876:108881]
+ sqlite3.c [111139:111144]
+ sqlite3.c [113072:113077]
+ sqlite3.c [113673:113678]
+ sqlite3.c [113944:113949]
+ sqlite3.c [119588:119593]
+ sqlite3.c [120128:120133]
+ sqlite3.c [121113:121118]
+ sqlite3.c [123499:123504]
+ sqlite3.c [124978:124983]
+ sqlite3.c [128109:128114]
+ sqlite3.c [128253:128258]
+ sqlite3.c [128273:128278]
+ sqlite3.c [129825:129830]
+ sqlite3.c [133211:133216]
+ sqlite3.c [134276:134281]
+ sqlite3.c [141829:141834]
+ sqlite3.c [142029:142034]
+ sqlite3.c [143461:143466]
+ sqlite3.c [144801:144806]
+ sqlite3.c [145119:145124]
+ sqlite3.c [145528:145533]
+ sqlite3.c [146875:146880]
+ sqlite3.c [146897:146902]
+ sqlite3.c [150223:150228]
+ sqlite3.c [152063:152068]
+ sqlite3.c [158301:158306]
+ sqlite3.c [161411:161416]
+ sqlite3.c [166821:166826]
+ sqlite3.c [168162:168167]
sqlite3.c [168455:168460]
- sqlite3.c [168492:168497]
- sqlite3.c [173321:173326]
- sqlite3.c [173656:173661]
- sqlite3.c [173948:173953]
- sqlite3.c [174160:174165]
- sqlite3.c [180712:180717]
- sqlite3.c [181271:181276]
- sqlite3.c [182567:182572]
- sqlite3.c [182953:182958]
- sqlite3.c [183618:183623]
- sqlite3.c [184141:184146]
- sqlite3.c [184378:184383]
- sqlite3.c [184839:184844]
- sqlite3.c [190651:190656]
- sqlite3.c [192405:192410]
- sqlite3.c [192805:192810]
- sqlite3.c [193191:193196]
- sqlite3.c [195869:195874]
- sqlite3.c [200273:200278]
- sqlite3.c [202272:202277]
- sqlite3.c [202829:202834]
- sqlite3.c [203094:203099]
- sqlite3.c [203185:203190]
- sqlite3.c [209052:209057]
- sqlite3.c [209955:209960]
- sqlite3.c [216193:216198]
- sqlite3.c [216769:216774]
- sqlite3.c [217645:217650]
- sqlite3.c [219122:219127]
- sqlite3.c [219837:219842]
- sqlite3.c [220246:220251]
- sqlite3.c [221212:221217]
- sqlite3.c [224281:224286]
- sqlite3.c [224842:224847]
- sqlite3.c [231662:231667]
- sqlite3.c [234589:234594]
- sqlite3.c [235758:235763]
- sqlite3.c [237174:237179]
- sqlite3.c [237953:237958]
- sqlite3.c [238298:238303]
- sqlite3.c [239096:239101]
+ sqlite3.c [168476:168481]
+ sqlite3.c [168509:168514]
+ sqlite3.c [168546:168551]
+ sqlite3.c [173375:173380]
+ sqlite3.c [173710:173715]
+ sqlite3.c [174002:174007]
+ sqlite3.c [174214:174219]
+ sqlite3.c [180766:180771]
+ sqlite3.c [181325:181330]
+ sqlite3.c [182621:182626]
+ sqlite3.c [183007:183012]
+ sqlite3.c [183672:183677]
+ sqlite3.c [184195:184200]
+ sqlite3.c [184432:184437]
+ sqlite3.c [184893:184898]
+ sqlite3.c [190705:190710]
+ sqlite3.c [192459:192464]
+ sqlite3.c [192859:192864]
+ sqlite3.c [193245:193250]
+ sqlite3.c [195947:195952]
+ sqlite3.c [200351:200356]
+ sqlite3.c [202350:202355]
+ sqlite3.c [202907:202912]
+ sqlite3.c [203172:203177]
+ sqlite3.c [203263:203268]
+ sqlite3.c [209130:209135]
+ sqlite3.c [210033:210038]
+ sqlite3.c [216271:216276]
+ sqlite3.c [216847:216852]
+ sqlite3.c [217723:217728]
+ sqlite3.c [219200:219205]
+ sqlite3.c [219915:219920]
+ sqlite3.c [220324:220329]
+ sqlite3.c [221290:221295]
+ sqlite3.c [224359:224364]
+ sqlite3.c [224920:224925]
+ sqlite3.c [231740:231745]
+ sqlite3.c [234667:234672]
+ sqlite3.c [235836:235841]
+ sqlite3.c [237252:237257]
+ sqlite3.c [238031:238036]
+ sqlite3.c [238376:238381]
+ sqlite3.c [239174:239179]
sqlite3.h [4:9]
sqlite3.h [10392:10397]
sqlite3.h [12234:12239]
@@ -256,7 +256,7 @@ BELONGS ya.make
Match type : REFERENCE
Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/proprietary-license.LICENSE
Files with this license:
- sqlite3.c [120175:120175]
+ sqlite3.c [120217:120217]
KEEP Public-Domain f14cda0580418473b9b9cbd71db6f933
BELONGS ya.make
@@ -269,4 +269,4 @@ BELONGS ya.make
Match type : TEXT
Links : http://www.linfo.org/publicdomain.html, https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/public-domain.LICENSE
Files with this license:
- sqlite3.c [29430:29431]
+ sqlite3.c [29432:29433]
diff --git a/contrib/libs/sqlite3/config.h b/contrib/libs/sqlite3/config.h
index f5d600588d..d874fae07c 100644
--- a/contrib/libs/sqlite3/config.h
+++ b/contrib/libs/sqlite3/config.h
@@ -114,13 +114,13 @@
#define PACKAGE_NAME "sqlite"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "sqlite 3.38.2"
+#define PACKAGE_STRING "sqlite 3.38.5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "sqlite"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "3.38.2"
+#define PACKAGE_VERSION "3.38.5"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
diff --git a/contrib/libs/sqlite3/sqlite3.c b/contrib/libs/sqlite3/sqlite3.c
index 751dc8e33f..f23b992475 100644
--- a/contrib/libs/sqlite3/sqlite3.c
+++ b/contrib/libs/sqlite3/sqlite3.c
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.38.2. By combining all the individual C code files into this
+** version 3.38.5. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -453,9 +453,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.38.2"
-#define SQLITE_VERSION_NUMBER 3038002
-#define SQLITE_SOURCE_ID "2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6alt1"
+#define SQLITE_VERSION "3.38.5"
+#define SQLITE_VERSION_NUMBER 3038005
+#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407alt1"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -19930,6 +19930,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
+SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*);
#ifdef SQLITE_ENABLE_CURSOR_HINTS
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
#endif
@@ -29339,8 +29340,9 @@ SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const cha
** Free any prior content in *pz and replace it with a copy of zNew.
*/
SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){
+ char *z = sqlite3DbStrDup(db, zNew);
sqlite3DbFree(db, *pz);
- *pz = sqlite3DbStrDup(db, zNew);
+ *pz = z;
}
/*
@@ -67766,6 +67768,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
** fragmented bytes within the page. */
memcpy(&aData[iAddr], &aData[pc], 2);
aData[hdr+7] += (u8)x;
+ testcase( pc+x>maxPC );
+ return &aData[pc];
}else if( x+pc > maxPC ){
/* This slot extends off the end of the usable part of the page */
*pRc = SQLITE_CORRUPT_PAGE(pPg);
@@ -71965,7 +71969,7 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );
assert( pPage->isInit );
if( pPage->leaf ){
- assert( pCur->ix<pCur->pPage->nCell );
+ assert( pCur->ix<pCur->pPage->nCell || CORRUPT_DB );
pCur->ix = (u16)idx;
*pRes = c;
rc = SQLITE_OK;
@@ -74489,7 +74493,7 @@ static int balance_nonroot(
iOvflSpace += sz;
assert( sz<=pBt->maxLocal+23 );
assert( iOvflSpace <= (int)pBt->pageSize );
- for(k=0; b.ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
+ for(k=0; b.ixNx[k]<=j && ALWAYS(k<NB*2); k++){}
pSrcEnd = b.apEnd[k];
if( SQLITE_WITHIN(pSrcEnd, pCell, pCell+sz) ){
rc = SQLITE_CORRUPT_BKPT;
@@ -78054,7 +78058,11 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
assert( !sqlite3VdbeMemIsRowSet(pMem) );
assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
|| desiredEnc==SQLITE_UTF16BE );
- if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
+ if( !(pMem->flags&MEM_Str) ){
+ pMem->enc = desiredEnc;
+ return SQLITE_OK;
+ }
+ if( pMem->enc==desiredEnc ){
return SQLITE_OK;
}
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
@@ -88381,6 +88389,8 @@ case OP_Gosub: { /* jump */
/* Most jump operations do a goto to this spot in order to update
** the pOp pointer. */
jump_to_p2:
+ assert( pOp->p2>0 ); /* There are never any jumps to instruction 0 */
+ assert( pOp->p2<p->nOp ); /* Jumps must be in range */
pOp = &aOp[pOp->p2 - 1];
break;
}
@@ -104761,6 +104771,38 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
return exprIsConst(p, 3, iCur);
}
+/*
+** Check pExpr to see if it is an invariant constraint on data source pSrc.
+** This is an optimization. False negatives will perhaps cause slower
+** queries, but false positives will yield incorrect answers. So when in
+** double, return 0.
+**
+** To be an invariant constraint, the following must be true:
+**
+** (1) pExpr cannot refer to any table other than pSrc->iCursor.
+**
+** (2) pExpr cannot use subqueries or non-deterministic functions.
+**
+** (*) ** Not applicable to this branch **
+**
+** (4) If pSrc is the right operand of a LEFT JOIN, then...
+** (4a) pExpr must come from an ON clause..
+** (4b) and specifically the ON clause associated with the LEFT JOIN.
+**
+** (5) If pSrc is not the right operand of a LEFT JOIN or the left
+** operand of a RIGHT JOIN, then pExpr must be from the WHERE
+** clause, not an ON clause.
+*/
+SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){
+ if( pSrc->fg.jointype & JT_LEFT ){
+ if( !ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (4a) */
+ if( pExpr->w.iRightJoinTable!=pSrc->iCursor ) return 0; /* rule (4b) */
+ }else{
+ if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (5) */
+ }
+ return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
+}
+
/*
** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy().
@@ -133829,6 +133871,14 @@ SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
}
/*
+** Maximum number of times that we will try again to prepare a statement
+** that returns SQLITE_ERROR_RETRY.
+*/
+#ifndef SQLITE_MAX_PREPARE_RETRY
+# define SQLITE_MAX_PREPARE_RETRY 25
+#endif
+
+/*
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
@@ -134002,7 +134052,7 @@ static int sqlite3LockAndPrepare(
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
assert( rc==SQLITE_OK || *ppStmt==0 );
if( rc==SQLITE_OK || db->mallocFailed ) break;
- }while( rc==SQLITE_ERROR_RETRY
+ }while( (rc==SQLITE_ERROR_RETRY && (cnt++)<SQLITE_MAX_PREPARE_RETRY)
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
@@ -139044,8 +139094,7 @@ static int pushDownWhereTerms(
Parse *pParse, /* Parse context (for malloc() and error reporting) */
Select *pSubq, /* The subquery whose WHERE clause is to be augmented */
Expr *pWhere, /* The WHERE clause of the outer query */
- int iCursor, /* Cursor number of the subquery */
- int isLeftJoin /* True if pSubq is the right term of a LEFT JOIN */
+ SrcItem *pSrc /* The subquery term of the outer FROM clause */
){
Expr *pNew;
int nChng = 0;
@@ -139080,10 +139129,11 @@ static int pushDownWhereTerms(
return 0; /* restriction (3) */
}
while( pWhere->op==TK_AND ){
- nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight,
- iCursor, isLeftJoin);
+ nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc);
pWhere = pWhere->pLeft;
}
+
+#if 0 /* Legacy code. Checks now done by sqlite3ExprIsTableConstraint() */
if( isLeftJoin
&& (ExprHasProperty(pWhere,EP_FromJoin)==0
|| pWhere->w.iRightJoinTable!=iCursor)
@@ -139095,7 +139145,9 @@ static int pushDownWhereTerms(
){
return 0; /* restriction (5) */
}
- if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
+#endif
+
+ if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){
nChng++;
pSubq->selFlags |= SF_PushDown;
while( pSubq ){
@@ -139103,8 +139155,8 @@ static int pushDownWhereTerms(
pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
unsetJoinExpr(pNew, -1);
x.pParse = pParse;
- x.iTable = iCursor;
- x.iNewTable = iCursor;
+ x.iTable = pSrc->iCursor;
+ x.iNewTable = pSrc->iCursor;
x.isLeftJoin = 0;
x.pEList = pSubq->pEList;
pNew = substExpr(&x, pNew);
@@ -140886,8 +140938,7 @@ SQLITE_PRIVATE int sqlite3Select(
if( OptimizationEnabled(db, SQLITE_PushDown)
&& (pItem->fg.isCte==0
|| (pItem->u2.pCteUse->eM10d!=M10d_Yes && pItem->u2.pCteUse->nUse<2))
- && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
- (pItem->fg.jointype & JT_OUTER)!=0)
+ && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem)
){
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x100 ){
@@ -148679,6 +148730,7 @@ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){
static int whereIndexExprTransNode(Walker *p, Expr *pExpr){
IdxExprTrans *pX = p->u.pIdxTrans;
if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
+ pExpr = sqlite3ExprSkipCollate(pExpr);
preserveExpr(pX, pExpr);
pExpr->affExpr = sqlite3ExprAffinity(pExpr);
pExpr->op = TK_COLUMN;
@@ -148838,6 +148890,8 @@ static SQLITE_NOINLINE void filterPullDown(
/* ,--- Because sqlite3ConstructBloomFilter() has will not have set
** vvvvv--' pLevel->regFilter if this were true. */
if( NEVER(pLoop->prereq & notReady) ) continue;
+ assert( pLevel->addrBrk==0 );
+ pLevel->addrBrk = addrNxt;
if( pLoop->wsFlags & WHERE_IPK ){
WhereTerm *pTerm = pLoop->aLTerm[0];
int regRowid;
@@ -148864,6 +148918,7 @@ static SQLITE_NOINLINE void filterPullDown(
VdbeCoverage(pParse->pVdbe);
}
pLevel->regFilter = 0;
+ pLevel->addrBrk = 0;
}
}
@@ -152812,8 +152867,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
** WHERE clause (or the ON clause of a LEFT join) that constrain which
** rows of the target table (pSrc) that can be used. */
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && ((pSrc->fg.jointype&JT_LEFT)==0 || ExprHasProperty(pExpr,EP_FromJoin))
- && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor)
+ && sqlite3ExprIsTableConstraint(pExpr, pSrc)
){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
@@ -153052,7 +153106,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && sqlite3ExprIsTableConstant(pExpr, iCur)
+ && sqlite3ExprIsTableConstraint(pExpr, pItem)
){
sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
}
@@ -159972,7 +160026,7 @@ static void windowAggStep(
for(iEnd=sqlite3VdbeCurrentAddr(v); iOp<iEnd; iOp++){
VdbeOp *pOp = sqlite3VdbeGetOp(v, iOp);
- if( pOp->opcode==OP_Column && pOp->p1==pWin->iEphCsr ){
+ if( pOp->opcode==OP_Column && pOp->p1==pMWin->iEphCsr ){
pOp->p1 = csr;
}
}
@@ -194306,14 +194360,15 @@ static JsonNode *jsonLookupStep(
*pzErr = zPath;
return 0;
}
+ testcase( nKey==0 );
}else{
zKey = zPath;
for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
nKey = i;
- }
- if( nKey==0 ){
- *pzErr = zPath;
- return 0;
+ if( nKey==0 ){
+ *pzErr = zPath;
+ return 0;
+ }
}
j = 1;
for(;;){
@@ -195461,6 +195516,33 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){
return SQLITE_OK;
}
+/* Append an object label to the JSON Path being constructed
+** in pStr.
+*/
+static void jsonAppendObjectPathElement(
+ JsonString *pStr,
+ JsonNode *pNode
+){
+ int jj, nn;
+ const char *z;
+ assert( pNode->eType==JSON_STRING );
+ assert( pNode->jnFlags & JNODE_LABEL );
+ assert( pNode->eU==1 );
+ z = pNode->u.zJContent;
+ nn = pNode->n;
+ assert( nn>=2 );
+ assert( z[0]=='"' );
+ assert( z[nn-1]=='"' );
+ if( nn>2 && sqlite3Isalpha(z[1]) ){
+ for(jj=2; jj<nn-1 && sqlite3Isalnum(z[jj]); jj++){}
+ if( jj==nn-1 ){
+ z++;
+ nn -= 2;
+ }
+ }
+ jsonPrintf(nn+2, pStr, ".%.*s", nn, z);
+}
+
/* Append the name of the path for element i to pStr
*/
static void jsonEachComputePath(
@@ -195485,10 +195567,7 @@ static void jsonEachComputePath(
}else{
assert( pUp->eType==JSON_OBJECT );
if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--;
- assert( pNode->eType==JSON_STRING );
- assert( pNode->jnFlags & JNODE_LABEL );
- assert( pNode->eU==1 );
- jsonPrintf(pNode->n+1, pStr, ".%.*s", pNode->n-2, pNode->u.zJContent+1);
+ jsonAppendObjectPathElement(pStr, pNode);
}
}
@@ -195559,8 +195638,7 @@ static int jsonEachColumn(
if( p->eType==JSON_ARRAY ){
jsonPrintf(30, &x, "[%d]", p->iRowid);
}else if( p->eType==JSON_OBJECT ){
- assert( pThis->eU==1 );
- jsonPrintf(pThis->n, &x, ".%.*s", pThis->n-2, pThis->u.zJContent+1);
+ jsonAppendObjectPathElement(&x, pThis);
}
}
jsonResult(&x);
@@ -234451,7 +234529,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
- sqlite3_result_text(pCtx, "fts5: 2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6f08f", -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(pCtx, "fts5: 2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe", -1, SQLITE_TRANSIENT);
}
/*
diff --git a/contrib/libs/sqlite3/sqlite3.h b/contrib/libs/sqlite3/sqlite3.h
index 8e45e939d2..4ef161c204 100644
--- a/contrib/libs/sqlite3/sqlite3.h
+++ b/contrib/libs/sqlite3/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.38.2"
-#define SQLITE_VERSION_NUMBER 3038002
-#define SQLITE_SOURCE_ID "2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6alt1"
+#define SQLITE_VERSION "3.38.5"
+#define SQLITE_VERSION_NUMBER 3038005
+#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407alt1"
/*
** CAPI3REF: Run-Time Library Version Numbers