Fossil SCM

Update the built-in SQLite to the latest pre-release of version 3.46.0, including the bug fix for the use of VALUES-as-coroutine with an OUTER JOIN.

drh 2024-04-18 17:14 trunk
Commit 8be14e391ea919a640f65a9370e636389527e565b7a719501c0a886e6bbf799b
2 files changed +35 -12 +1 -1
+35 -12
--- 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
-** 5dede50d9e7b6942df9f7b00fbfeaa2103c3.
21
+** 8c0f69e0e4ae0a446838cc193bfd4395fd25.
2222
*/
2323
#define SQLITE_CORE 1
2424
#define SQLITE_AMALGAMATION 1
2525
#ifndef SQLITE_PRIVATE
2626
# define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459459
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460460
** [sqlite_version()] and [sqlite_source_id()].
461461
*/
462462
#define SQLITE_VERSION "3.46.0"
463463
#define SQLITE_VERSION_NUMBER 3046000
464
-#define SQLITE_SOURCE_ID "2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d"
464
+#define SQLITE_SOURCE_ID "2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66"
465465
466466
/*
467467
** CAPI3REF: Run-Time Library Version Numbers
468468
** KEYWORDS: sqlite3_version sqlite3_sourceid
469469
**
@@ -75633,11 +75633,13 @@
7563375633
}
7563475634
memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
7563575635
pCur->curFlags |= BTCF_ValidOvfl;
7563675636
}else{
7563775637
/* Sanity check the validity of the overflow page cache */
75638
- assert( pCur->aOverflow[0]==nextPage || pCur->aOverflow[0]==0 );
75638
+ assert( pCur->aOverflow[0]==nextPage
75639
+ || pCur->aOverflow[0]==0
75640
+ || CORRUPT_DB );
7563975641
assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 );
7564075642
7564175643
/* If the overflow page-list cache has been allocated and the
7564275644
** entry for the first required overflow page is valid, skip
7564375645
** directly to it.
@@ -94207,11 +94209,13 @@
9420794209
9420894210
/* Opcode: EndCoroutine P1 * * * *
9420994211
**
9421094212
** The instruction at the address in register P1 is a Yield.
9421194213
** Jump to the P2 parameter of that Yield.
94212
-** After the jump, register P1 becomes undefined.
94214
+** After the jump, the value register P1 is left with a value
94215
+** such that subsequent OP_Yields go back to the this same
94216
+** OP_EndCoroutine instruction.
9421394217
**
9421494218
** See also: InitCoroutine
9421594219
*/
9421694220
case OP_EndCoroutine: { /* in1 */
9421794221
VdbeOp *pCaller;
@@ -94219,12 +94223,12 @@
9421994223
assert( pIn1->flags==MEM_Int );
9422094224
assert( pIn1->u.i>=0 && pIn1->u.i<p->nOp );
9422194225
pCaller = &aOp[pIn1->u.i];
9422294226
assert( pCaller->opcode==OP_Yield );
9422394227
assert( pCaller->p2>=0 && pCaller->p2<p->nOp );
94228
+ pIn1->u.i = (int)(pOp - p->aOp) - 1;
9422494229
pOp = &aOp[pCaller->p2 - 1];
94225
- pIn1->flags = MEM_Undefined;
9422694230
break;
9422794231
}
9422894232
9422994233
/* Opcode: Yield P1 P2 * * *
9423094234
**
@@ -159980,15 +159984,25 @@
159980159984
ExplainQueryPlan((pParse, 1, "RIGHT-JOIN %s", pTabItem->pTab->zName));
159981159985
sqlite3VdbeNoJumpsOutsideSubrtn(v, pRJ->addrSubrtn, pRJ->endSubrtn,
159982159986
pRJ->regReturn);
159983159987
for(k=0; k<iLevel; k++){
159984159988
int iIdxCur;
159989
+ SrcItem *pRight;
159990
+ assert( pWInfo->a[k].pWLoop->iTab == pWInfo->a[k].iFrom );
159991
+ pRight = &pWInfo->pTabList->a[pWInfo->a[k].iFrom];
159985159992
mAll |= pWInfo->a[k].pWLoop->maskSelf;
159986
- sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
159987
- iIdxCur = pWInfo->a[k].iIdxCur;
159988
- if( iIdxCur ){
159989
- sqlite3VdbeAddOp1(v, OP_NullRow, iIdxCur);
159993
+ if( pRight->fg.viaCoroutine ){
159994
+ sqlite3VdbeAddOp3(
159995
+ v, OP_Null, 0, pRight->regResult,
159996
+ pRight->regResult + pRight->pSelect->pEList->nExpr-1
159997
+ );
159998
+ }else{
159999
+ sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
160000
+ iIdxCur = pWInfo->a[k].iIdxCur;
160001
+ if( iIdxCur ){
160002
+ sqlite3VdbeAddOp1(v, OP_NullRow, iIdxCur);
160003
+ }
159990160004
}
159991160005
}
159992160006
if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
159993160007
mAll |= pLoop->maskSelf;
159994160008
for(k=0; k<pWC->nTerm; k++){
@@ -168861,12 +168875,21 @@
168861168875
if( pLevel->iLeftJoin ){
168862168876
int ws = pLoop->wsFlags;
168863168877
addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
168864168878
assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );
168865168879
if( (ws & WHERE_IDX_ONLY)==0 ){
168866
- assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor );
168867
- sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
168880
+ SrcItem *pSrc = &pTabList->a[pLevel->iFrom];
168881
+ assert( pLevel->iTabCur==pSrc->iCursor );
168882
+ if( pSrc->fg.viaCoroutine ){
168883
+ int m, n;
168884
+ n = pSrc->regResult;
168885
+ assert( pSrc->pTab!=0 );
168886
+ m = pSrc->pTab->nCol;
168887
+ sqlite3VdbeAddOp3(v, OP_Null, 0, n, n+m-1);
168888
+ }else{
168889
+ sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
168890
+ }
168868168891
}
168869168892
if( (ws & WHERE_INDEXED)
168870168893
|| ((ws & WHERE_MULTI_OR) && pLevel->u.pCoveringIdx)
168871168894
){
168872168895
if( ws & WHERE_MULTI_OR ){
@@ -252170,11 +252193,11 @@
252170252193
int nArg, /* Number of args */
252171252194
sqlite3_value **apUnused /* Function arguments */
252172252195
){
252173252196
assert( nArg==0 );
252174252197
UNUSED_PARAM2(nArg, apUnused);
252175
- sqlite3_result_text(pCtx, "fts5: 2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d", -1, SQLITE_TRANSIENT);
252198
+ sqlite3_result_text(pCtx, "fts5: 2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66", -1, SQLITE_TRANSIENT);
252176252199
}
252177252200
252178252201
/*
252179252202
** Return true if zName is the extension on one of the shadow tables used
252180252203
** by this module.
252181252204
--- 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 ** 5dede50d9e7b6942df9f7b00fbfeaa2103c3.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.46.0"
463 #define SQLITE_VERSION_NUMBER 3046000
464 #define SQLITE_SOURCE_ID "2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -75633,11 +75633,13 @@
75633 }
75634 memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
75635 pCur->curFlags |= BTCF_ValidOvfl;
75636 }else{
75637 /* Sanity check the validity of the overflow page cache */
75638 assert( pCur->aOverflow[0]==nextPage || pCur->aOverflow[0]==0 );
 
 
75639 assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 );
75640
75641 /* If the overflow page-list cache has been allocated and the
75642 ** entry for the first required overflow page is valid, skip
75643 ** directly to it.
@@ -94207,11 +94209,13 @@
94207
94208 /* Opcode: EndCoroutine P1 * * * *
94209 **
94210 ** The instruction at the address in register P1 is a Yield.
94211 ** Jump to the P2 parameter of that Yield.
94212 ** After the jump, register P1 becomes undefined.
 
 
94213 **
94214 ** See also: InitCoroutine
94215 */
94216 case OP_EndCoroutine: { /* in1 */
94217 VdbeOp *pCaller;
@@ -94219,12 +94223,12 @@
94219 assert( pIn1->flags==MEM_Int );
94220 assert( pIn1->u.i>=0 && pIn1->u.i<p->nOp );
94221 pCaller = &aOp[pIn1->u.i];
94222 assert( pCaller->opcode==OP_Yield );
94223 assert( pCaller->p2>=0 && pCaller->p2<p->nOp );
 
94224 pOp = &aOp[pCaller->p2 - 1];
94225 pIn1->flags = MEM_Undefined;
94226 break;
94227 }
94228
94229 /* Opcode: Yield P1 P2 * * *
94230 **
@@ -159980,15 +159984,25 @@
159980 ExplainQueryPlan((pParse, 1, "RIGHT-JOIN %s", pTabItem->pTab->zName));
159981 sqlite3VdbeNoJumpsOutsideSubrtn(v, pRJ->addrSubrtn, pRJ->endSubrtn,
159982 pRJ->regReturn);
159983 for(k=0; k<iLevel; k++){
159984 int iIdxCur;
 
 
 
159985 mAll |= pWInfo->a[k].pWLoop->maskSelf;
159986 sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
159987 iIdxCur = pWInfo->a[k].iIdxCur;
159988 if( iIdxCur ){
159989 sqlite3VdbeAddOp1(v, OP_NullRow, iIdxCur);
 
 
 
 
 
 
 
159990 }
159991 }
159992 if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
159993 mAll |= pLoop->maskSelf;
159994 for(k=0; k<pWC->nTerm; k++){
@@ -168861,12 +168875,21 @@
168861 if( pLevel->iLeftJoin ){
168862 int ws = pLoop->wsFlags;
168863 addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
168864 assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );
168865 if( (ws & WHERE_IDX_ONLY)==0 ){
168866 assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor );
168867 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
 
 
 
 
 
 
 
 
 
168868 }
168869 if( (ws & WHERE_INDEXED)
168870 || ((ws & WHERE_MULTI_OR) && pLevel->u.pCoveringIdx)
168871 ){
168872 if( ws & WHERE_MULTI_OR ){
@@ -252170,11 +252193,11 @@
252170 int nArg, /* Number of args */
252171 sqlite3_value **apUnused /* Function arguments */
252172 ){
252173 assert( nArg==0 );
252174 UNUSED_PARAM2(nArg, apUnused);
252175 sqlite3_result_text(pCtx, "fts5: 2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d", -1, SQLITE_TRANSIENT);
252176 }
252177
252178 /*
252179 ** Return true if zName is the extension on one of the shadow tables used
252180 ** by this module.
252181
--- 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 ** 8c0f69e0e4ae0a446838cc193bfd4395fd25.
22 */
23 #define SQLITE_CORE 1
24 #define SQLITE_AMALGAMATION 1
25 #ifndef SQLITE_PRIVATE
26 # define SQLITE_PRIVATE static
@@ -459,11 +459,11 @@
459 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
460 ** [sqlite_version()] and [sqlite_source_id()].
461 */
462 #define SQLITE_VERSION "3.46.0"
463 #define SQLITE_VERSION_NUMBER 3046000
464 #define SQLITE_SOURCE_ID "2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66"
465
466 /*
467 ** CAPI3REF: Run-Time Library Version Numbers
468 ** KEYWORDS: sqlite3_version sqlite3_sourceid
469 **
@@ -75633,11 +75633,13 @@
75633 }
75634 memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));
75635 pCur->curFlags |= BTCF_ValidOvfl;
75636 }else{
75637 /* Sanity check the validity of the overflow page cache */
75638 assert( pCur->aOverflow[0]==nextPage
75639 || pCur->aOverflow[0]==0
75640 || CORRUPT_DB );
75641 assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 );
75642
75643 /* If the overflow page-list cache has been allocated and the
75644 ** entry for the first required overflow page is valid, skip
75645 ** directly to it.
@@ -94207,11 +94209,13 @@
94209
94210 /* Opcode: EndCoroutine P1 * * * *
94211 **
94212 ** The instruction at the address in register P1 is a Yield.
94213 ** Jump to the P2 parameter of that Yield.
94214 ** After the jump, the value register P1 is left with a value
94215 ** such that subsequent OP_Yields go back to the this same
94216 ** OP_EndCoroutine instruction.
94217 **
94218 ** See also: InitCoroutine
94219 */
94220 case OP_EndCoroutine: { /* in1 */
94221 VdbeOp *pCaller;
@@ -94219,12 +94223,12 @@
94223 assert( pIn1->flags==MEM_Int );
94224 assert( pIn1->u.i>=0 && pIn1->u.i<p->nOp );
94225 pCaller = &aOp[pIn1->u.i];
94226 assert( pCaller->opcode==OP_Yield );
94227 assert( pCaller->p2>=0 && pCaller->p2<p->nOp );
94228 pIn1->u.i = (int)(pOp - p->aOp) - 1;
94229 pOp = &aOp[pCaller->p2 - 1];
 
94230 break;
94231 }
94232
94233 /* Opcode: Yield P1 P2 * * *
94234 **
@@ -159980,15 +159984,25 @@
159984 ExplainQueryPlan((pParse, 1, "RIGHT-JOIN %s", pTabItem->pTab->zName));
159985 sqlite3VdbeNoJumpsOutsideSubrtn(v, pRJ->addrSubrtn, pRJ->endSubrtn,
159986 pRJ->regReturn);
159987 for(k=0; k<iLevel; k++){
159988 int iIdxCur;
159989 SrcItem *pRight;
159990 assert( pWInfo->a[k].pWLoop->iTab == pWInfo->a[k].iFrom );
159991 pRight = &pWInfo->pTabList->a[pWInfo->a[k].iFrom];
159992 mAll |= pWInfo->a[k].pWLoop->maskSelf;
159993 if( pRight->fg.viaCoroutine ){
159994 sqlite3VdbeAddOp3(
159995 v, OP_Null, 0, pRight->regResult,
159996 pRight->regResult + pRight->pSelect->pEList->nExpr-1
159997 );
159998 }else{
159999 sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
160000 iIdxCur = pWInfo->a[k].iIdxCur;
160001 if( iIdxCur ){
160002 sqlite3VdbeAddOp1(v, OP_NullRow, iIdxCur);
160003 }
160004 }
160005 }
160006 if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
160007 mAll |= pLoop->maskSelf;
160008 for(k=0; k<pWC->nTerm; k++){
@@ -168861,12 +168875,21 @@
168875 if( pLevel->iLeftJoin ){
168876 int ws = pLoop->wsFlags;
168877 addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);
168878 assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );
168879 if( (ws & WHERE_IDX_ONLY)==0 ){
168880 SrcItem *pSrc = &pTabList->a[pLevel->iFrom];
168881 assert( pLevel->iTabCur==pSrc->iCursor );
168882 if( pSrc->fg.viaCoroutine ){
168883 int m, n;
168884 n = pSrc->regResult;
168885 assert( pSrc->pTab!=0 );
168886 m = pSrc->pTab->nCol;
168887 sqlite3VdbeAddOp3(v, OP_Null, 0, n, n+m-1);
168888 }else{
168889 sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur);
168890 }
168891 }
168892 if( (ws & WHERE_INDEXED)
168893 || ((ws & WHERE_MULTI_OR) && pLevel->u.pCoveringIdx)
168894 ){
168895 if( ws & WHERE_MULTI_OR ){
@@ -252170,11 +252193,11 @@
252193 int nArg, /* Number of args */
252194 sqlite3_value **apUnused /* Function arguments */
252195 ){
252196 assert( nArg==0 );
252197 UNUSED_PARAM2(nArg, apUnused);
252198 sqlite3_result_text(pCtx, "fts5: 2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66", -1, SQLITE_TRANSIENT);
252199 }
252200
252201 /*
252202 ** Return true if zName is the extension on one of the shadow tables used
252203 ** by this module.
252204
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.46.0"
150150
#define SQLITE_VERSION_NUMBER 3046000
151
-#define SQLITE_SOURCE_ID "2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d"
151
+#define SQLITE_SOURCE_ID "2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
157157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.46.0"
150 #define SQLITE_VERSION_NUMBER 3046000
151 #define SQLITE_SOURCE_ID "2024-04-12 15:02:16 5dede50d9e7b6942df9f7b00fbfeaa2103c36c5da01d63d88136fb0ef4b7d26d"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
157
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.46.0"
150 #define SQLITE_VERSION_NUMBER 3046000
151 #define SQLITE_SOURCE_ID "2024-04-18 16:11:01 8c0f69e0e4ae0a446838cc193bfd4395fd251f3c7659b35ac388e5a0a7650a66"
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