Compare commits

..

29 Commits

Author SHA1 Message Date
drh 2eb9adb564 Assume that a function is able to return a subtype if either (1) it is itself
marked with SQLITE_RESULT_SUBTYPE, or (2) one of its arguments is a function
that is able to return a subtype.  This check-in backs out the code changes
from the previous two on this same branch, but keeps the test cases from
the previous two.

FossilOrigin-Name: f16b200f25a0ec59ad765d254d81c3ffdba21f79e6e82807a7b80d00627952e2
2024-05-04 15:04:45 +00:00
drh 5b9b7cba22 Functions that pass through the sqlite3_value of one of their arguments must
also be marked as SQLITE_RESULT_SUBTYPE, in case one of their arguments has
a subtype.

FossilOrigin-Name: 2f9fba931d9f80b3d5dffb175180098756bccc6a8f665d7aaf8826970ab60d72
2024-05-04 11:31:34 +00:00
drh 0901571f0a The coalesce(), ifnull(), and iif() functions pass through subtype values
from their arguments, and hence need to have the SQLITE_RESULT_SUBTYPE flag
set.  This fixes an corner-case for the patch at [ba789a7804ab96d8].

FossilOrigin-Name: cdd1610c44876623e629bb8e5779ea689e6d23c545552b088eca63ad2d1cf8da
2024-05-03 19:35:43 +00:00
dan 9c0d777a9f Fix a problem with queries that use "IN(...) ORDER BY ... NULLS LAST" or similar introduced by [d7648e21605a0b38].
FossilOrigin-Name: 26b2d9390f1273ee0e3f3c96f6bc5bf0e9c1dcfd0d9ecd993dba487ef5a07f7e
2024-05-02 19:22:23 +00:00
dan 72814933b9 Avoid an assert failure accessible only when internal testing features are enabled. dbsqlfuzz crash-66abacda6bca6bd531e25595e8c8068e2c710326.txt.
FossilOrigin-Name: fbc446daac761dd1b66a85c9b61e1d5af194a8fd665600c43a874da38cc6ec10
2024-05-02 18:16:23 +00:00
dan 01508c814c Fix a case where the recovery extension might write uninitialized data to the recovered database.
FossilOrigin-Name: 8519b4d0393ed17eed06bceffbc891fe8cae0bc1d466a79eba0602ef46b07c56
2024-05-02 17:46:52 +00:00
dan aeb62886c5 Avoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return at most 1 row.
FossilOrigin-Name: d7648e21605a0b381b1935a47e5a77bdfacc4cc96f03d6bb7956f8f4e6a40648
2024-05-02 14:48:58 +00:00
drh d059774365 Fix the CREATE TABLE performance issue described by
[forum:/forumpost/4cf69794d9dfff7c|forum thread 4cf69794d9dfff7c] in two
different ways:  (1) Omit the call to PRAGMA integrity_check('X') that was
being done after CREATE TABLE "X" because the result was being ignored and
the integrity_check was not doing anything other than burning CPU cycles.
(2) Do not interpret the argument to PRAGMA integrity_check as a number if it
is in fact a string that looks like a number.

FossilOrigin-Name: 71f08b912251c8a3ac1bd8e344903336648e4187f7493f8c126e60b3b51b9f09
2024-05-02 12:14:31 +00:00
drh 9b4e7898d7 Add a test case to the fix to PRAGMA integrity_check in the previous check-in.
FossilOrigin-Name: 39a57b596d309d9e2d4c59409fe5d36e0665781ce0307d157ff8b6e883161bbb
2024-05-02 12:00:36 +00:00
drh 78bc1339ac Do not accept a string that looks like a number used as an argument to
PRAGMA integrity_check as a number.  Treat it as a table name that just
happens to look like a number.

FossilOrigin-Name: b04e7a23478f1012e501a810f3e09cca81a66e802f5f72cae80c81120174e2cb
2024-05-02 11:52:31 +00:00
drh 2ae4531c89 Omit the OP_SqlExec to "PRAGMA integrity_check" added by [348fa7aaf7958b3f]
because it is a no-op.  Even if the integrity_check failes, the CREATE TABLE
is stull successful.  The OP_SqlExec just burns CPU cycles for no reason.

FossilOrigin-Name: 532795acd1c800751737fe70148f9ae691e9cf11b836577f8538421d24cab2fe
2024-05-02 11:51:26 +00:00
dan f3ea92cceb Avoid an OP_Next in cases where an IN(...) query against a UNIQUE index may return at most 1 row.
FossilOrigin-Name: 560f64157d2fe40e107582eebb6526185c9c43305e364f4132e182dbec5b210a
2024-05-01 19:48:24 +00:00
dan 2ad1e92858 Fix another problem in the recovery extension where a corrupt sqlite_schema table could lead to excessive memory consumption.
FossilOrigin-Name: 1c7e33a8aa0e6122b5ef606e4a7d95e8ecd9440216d4b099fe8f2a40653422be
2024-05-01 16:25:46 +00:00
dan 19ca99eea4 Fix a problem causing the recovery extension to use excessive memory and CPU time in some cases.
FossilOrigin-Name: 8de85170d53e1d2a2abe14508a222377b9493e25f3174b8f0f773427deb8df26
2024-05-01 14:42:20 +00:00
dan 8d5fe073d2 Avoid 32-bit overflow when calculating ncycle for ".scanstats vm".
FossilOrigin-Name: 2858efa06d4fc7b412b892f35f5e9a766b467b4a5b74d602a030d25443f9efb4
2024-04-30 19:34:15 +00:00
drh b11daa50f9 Fix issues in [/info/1e227ad9f413227f|LIMIT/OFFSET support for virtual tables].
The first problem was reported by
[forum:/forumpost/c243b8f856|forum post c243b8f856].  That report prompted
an enhancement to the generate_series() (also included in this merge) which
in turn identified other similar issues.

FossilOrigin-Name: 5f6c079d847e3664ec5acaf1b3e989efe0d548c211ae4a18936162b36df89065
2024-04-26 19:10:15 +00:00
stephan b95c1d0ac9 Internal JS doc touchups. No functional changes.
FossilOrigin-Name: 626b997b4e727554d7ec8b60fb37b2a94cb861a87325da4ae484bd9aa8961ca5
2024-04-26 18:42:50 +00:00
stephan 6c290ccd49 Additional internal docs in the wasm utilities.
FossilOrigin-Name: 5a2245a9ebae6d23cd343e46b9d730f66ec4d5ffc91b83ed11a0fbd2194ad807
2024-04-26 18:24:23 +00:00
dan 4c3ab545a9 Allow virtual table implementations to handle OFFSET but not LIMIT, but not LIMIT but not OFFSET.
FossilOrigin-Name: 90e5c8226a695e838e8c1703a9b8598e654d216799e8806c4d1a1f20c28c6486
2024-04-26 18:13:11 +00:00
dan 297472a2fc Have where.c ignore any plan from a virtual table that tries to use LIMIT/OFFSET without also using all WHERE constraints.
FossilOrigin-Name: 7d30596496c6a7a37b925f13d8d94d5de224ec31bb86594fa4cc07b10082e776
2024-04-26 17:19:59 +00:00
drh d3a4dbe4b8 Further fixes and improvements to the generate_series() enhancements on
this branch.

FossilOrigin-Name: b7d9bd7ee2f4100608063fdf7648f290351465d393bc876a89704f643358853e
2024-04-26 17:09:33 +00:00
drh 84a231eb61 Use hex flag masks rather than decimals in ext/misc/series.c.
FossilOrigin-Name: a94e2cd02873c283d46bf6c21d0306ad454881d7882bb167d043cc79f79a2396
2024-04-26 14:36:28 +00:00
dan 3afd5b6d65 Fix a problem allowing a LIMIT constraint to be passed to a virtual table in cases where there exist WHERE terms that cannot also be passed.
FossilOrigin-Name: 72c8ed9698dd2aadee7b84fd293e8306233f0fe5b5b5731687482444fdf461c7
2024-04-26 14:32:58 +00:00
drh 99ac2324aa Fix handling of LIMIT and OFFSET in virtual tables that are part of
a compound SELECT.

FossilOrigin-Name: 40421c1c4ed5bb1ed79ad7ee37cb5a4f0b7864c1eb94abd8ee357ab2202cad30
2024-04-26 13:38:43 +00:00
drh 317b7416a6 Enhance the generated_series() table-valued-function to respond to
LIMIT and OFFSET.  Use this to add new test cases for LIMIT and OFFSET
on virtual tables in a compound SELECT.

FossilOrigin-Name: 408d47ecaa3b906d0886f76a22b76339ec5878270ffe8d1838c74de09c29a33e
2024-04-26 13:30:48 +00:00
dan d591a5b93d Add test demonstrating the problem at [forum:/forumpost/c243b8f856|forum post c243b8f856]. No fix yet.
FossilOrigin-Name: 1685495c0a00238c9c92cce01af8108204a2fad22433ed3e7bba3c9da9ee0766
2024-04-26 12:01:17 +00:00
drh fed13d50a9 Fix the TreeView display of a LIMIT clause on a compound query. Debugging
code only - not part of production builds.

FossilOrigin-Name: 38f1e5ce4eedd59fbeb0a0d676d26dfe8a3313189ab9b9e4a5a1ed6721b73a14
2024-04-26 11:32:50 +00:00
drh ec14ef80b0 Improvement to the way that affinity is determined for columns of a
compound subquery.  The affinity is the affinity of the left-most
arm of the compound subquery that has an affinity other than NONE, adjusted
to accommodate the data types coming out of the other arms.

FossilOrigin-Name: e6df846f36209bac3e420dd80ce2bbbd87ab7a20b8063fce05f78a3c7ab6027e
2024-04-25 23:26:11 +00:00
stephan c859f0267c wasm: add a makefile comment about the static sqlite3.h/c version info injected into the JS files possibly differing from the runtime-emited version info when a user provides their own sqlite3.c.
FossilOrigin-Name: d99a01a0f6e1f70f70c9a0625aeaa8a8015eba352bcfb3978eafca6df10ba5a8
2024-04-25 06:52:19 +00:00
22 changed files with 1256 additions and 110 deletions
+77 -25
View File
@@ -376,13 +376,13 @@ static int seriesEof(sqlite3_vtab_cursor *cur){
** parameter. (idxStr is not used in this implementation.) idxNum
** is a bitmask showing which constraints are available:
**
** 1: start=VALUE
** 2: stop=VALUE
** 4: step=VALUE
**
** Also, if bit 8 is set, that means that the series should be output
** in descending order rather than in ascending order. If bit 16 is
** set, then output must appear in ascending order.
** 0x01: start=VALUE
** 0x02: stop=VALUE
** 0x04: step=VALUE
** 0x08: descending order
** 0x10: ascending order
** 0x20: LIMIT VALUE
** 0x40: OFFSET VALUE
**
** This routine should initialize the cursor and position it so that it
** is pointing at the first row, or pointing off the end of the table
@@ -396,26 +396,44 @@ static int seriesFilter(
series_cursor *pCur = (series_cursor *)pVtabCursor;
int i = 0;
(void)idxStrUnused;
if( idxNum & 1 ){
if( idxNum & 0x01 ){
pCur->ss.iBase = sqlite3_value_int64(argv[i++]);
}else{
pCur->ss.iBase = 0;
}
if( idxNum & 2 ){
if( idxNum & 0x02 ){
pCur->ss.iTerm = sqlite3_value_int64(argv[i++]);
}else{
pCur->ss.iTerm = 0xffffffff;
}
if( idxNum & 4 ){
if( idxNum & 0x04 ){
pCur->ss.iStep = sqlite3_value_int64(argv[i++]);
if( pCur->ss.iStep==0 ){
pCur->ss.iStep = 1;
}else if( pCur->ss.iStep<0 ){
if( (idxNum & 16)==0 ) idxNum |= 8;
if( (idxNum & 0x10)==0 ) idxNum |= 0x08;
}
}else{
pCur->ss.iStep = 1;
}
if( idxNum & 0x20 ){
sqlite3_int64 iLimit = sqlite3_value_int64(argv[i++]);
sqlite3_int64 iTerm;
if( idxNum & 0x40 ){
sqlite3_int64 iOffset = sqlite3_value_int64(argv[i++]);
if( iOffset>0 ){
pCur->ss.iBase += pCur->ss.iStep*iOffset;
}
}
if( iLimit>=0 ){
iTerm = pCur->ss.iBase + (iLimit - 1)*pCur->ss.iStep;
if( pCur->ss.iStep<0 ){
if( iTerm>pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
}else{
if( iTerm<pCur->ss.iTerm ) pCur->ss.iTerm = iTerm;
}
}
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
@@ -426,7 +444,7 @@ static int seriesFilter(
break;
}
}
if( idxNum & 8 ){
if( idxNum & 0x08 ){
pCur->ss.isReversing = pCur->ss.iStep > 0;
}else{
pCur->ss.isReversing = pCur->ss.iStep < 0;
@@ -446,10 +464,13 @@ static int seriesFilter(
**
** The query plan is represented by bits in idxNum:
**
** (1) start = $value -- constraint exists
** (2) stop = $value -- constraint exists
** (4) step = $value -- constraint exists
** (8) output in descending order
** 0x01 start = $value -- constraint exists
** 0x02 stop = $value -- constraint exists
** 0x04 step = $value -- constraint exists
** 0x08 output is in descending order
** 0x10 output is in ascending order
** 0x20 LIMIT $value -- constraint exists
** 0x40 OFFSET $value -- constraint exists
*/
static int seriesBestIndex(
sqlite3_vtab *pVTab,
@@ -457,10 +478,12 @@ static int seriesBestIndex(
){
int i, j; /* Loop over constraints */
int idxNum = 0; /* The query plan bitmask */
#ifndef ZERO_ARGUMENT_GENERATE_SERIES
int bStartSeen = 0; /* EQ constraint seen on the START column */
#endif
int unusableMask = 0; /* Mask of unusable constraints */
int nArg = 0; /* Number of arguments that seriesFilter() expects */
int aIdx[3]; /* Constraints on start, stop, and step */
int aIdx[5]; /* Constraints on start, stop, step, LIMIT, OFFSET */
const struct sqlite3_index_constraint *pConstraint;
/* This implementation assumes that the start, stop, and step columns
@@ -468,28 +491,54 @@ static int seriesBestIndex(
assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );
aIdx[0] = aIdx[1] = aIdx[2] = -1;
aIdx[0] = aIdx[1] = aIdx[2] = aIdx[3] = aIdx[4] = -1;
pConstraint = pIdxInfo->aConstraint;
for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
int iCol; /* 0 for start, 1 for stop, 2 for step */
int iMask; /* bitmask for those column */
int op = pConstraint->op;
if( op>=SQLITE_INDEX_CONSTRAINT_LIMIT
&& op<=SQLITE_INDEX_CONSTRAINT_OFFSET
){
if( pConstraint->usable==0 ){
/* do nothing */
}else if( op==SQLITE_INDEX_CONSTRAINT_LIMIT ){
aIdx[3] = i;
idxNum |= 0x20;
}else{
assert( op==SQLITE_INDEX_CONSTRAINT_OFFSET );
aIdx[4] = i;
idxNum |= 0x40;
}
continue;
}
if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
iCol = pConstraint->iColumn - SERIES_COLUMN_START;
assert( iCol>=0 && iCol<=2 );
iMask = 1 << iCol;
if( iCol==0 ) bStartSeen = 1;
#ifndef ZERO_ARGUMENT_GENERATE_SERIES
if( iCol==0 && op==SQLITE_INDEX_CONSTRAINT_EQ ){
bStartSeen = 1;
}
#endif
if( pConstraint->usable==0 ){
unusableMask |= iMask;
continue;
}else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
}else if( op==SQLITE_INDEX_CONSTRAINT_EQ ){
idxNum |= iMask;
aIdx[iCol] = i;
}
}
for(i=0; i<3; i++){
if( aIdx[3]==0 ){
/* Ignore OFFSET if LIMIT is omitted */
idxNum &= ~0x60;
aIdx[4] = 0;
}
for(i=0; i<5; i++){
if( (j = aIdx[i])>=0 ){
pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
pIdxInfo->aConstraintUsage[j].omit =
!SQLITE_SERIES_CONSTRAINT_VERIFY || i>=3;
}
}
/* The current generate_column() implementation requires at least one
@@ -510,19 +559,22 @@ static int seriesBestIndex(
** this plan is unusable */
return SQLITE_CONSTRAINT;
}
if( (idxNum & 3)==3 ){
if( (idxNum & 0x03)==0x03 ){
/* Both start= and stop= boundaries are available. This is the
** the preferred case */
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
pIdxInfo->estimatedRows = 1000;
if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){
if( pIdxInfo->aOrderBy[0].desc ){
idxNum |= 8;
idxNum |= 0x08;
}else{
idxNum |= 16;
idxNum |= 0x10;
}
pIdxInfo->orderByConsumed = 1;
}
}else if( (idxNum & 0x21)==0x21 ){
/* We have start= and LIMIT */
pIdxInfo->estimatedRows = 2500;
}else{
/* If either boundary is missing, we have to generate a huge span
** of numbers. Make this case very expensive so that the query
+57 -23
View File
@@ -88,6 +88,15 @@ typedef unsigned int u32;
typedef struct DbdataTable DbdataTable;
typedef struct DbdataCursor DbdataCursor;
typedef struct DbdataBuffer DbdataBuffer;
/*
** Buffer type.
*/
struct DbdataBuffer {
u8 *aBuf;
sqlite3_int64 nBuf;
};
/* Cursor object */
struct DbdataCursor {
@@ -104,7 +113,7 @@ struct DbdataCursor {
sqlite3_int64 iRowid;
/* Only for the sqlite_dbdata table */
u8 *pRec; /* Buffer containing current record */
DbdataBuffer rec;
sqlite3_int64 nRec; /* Size of pRec[] in bytes */
sqlite3_int64 nHdr; /* Size of header in bytes */
int iField; /* Current field number */
@@ -149,6 +158,31 @@ struct DbdataTable {
" schema TEXT HIDDEN" \
")"
/*
** Ensure the buffer passed as the first argument is at least nMin bytes
** in size. If an error occurs while attempting to resize the buffer,
** SQLITE_NOMEM is returned. Otherwise, SQLITE_OK.
*/
static int dbdataBufferSize(DbdataBuffer *pBuf, sqlite3_int64 nMin){
if( nMin>pBuf->nBuf ){
sqlite3_int64 nNew = nMin+16384;
u8 *aNew = (u8*)sqlite3_realloc64(pBuf->aBuf, nNew);
if( aNew==0 ) return SQLITE_NOMEM;
pBuf->aBuf = aNew;
pBuf->nBuf = nNew;
}
return SQLITE_OK;
}
/*
** Release the allocation managed by buffer pBuf.
*/
static void dbdataBufferFree(DbdataBuffer *pBuf){
sqlite3_free(pBuf->aBuf);
memset(pBuf, 0, sizeof(*pBuf));
}
/*
** Connect to an sqlite_dbdata (pAux==0) or sqlite_dbptr (pAux!=0) virtual
** table.
@@ -289,8 +323,7 @@ static void dbdataResetCursor(DbdataCursor *pCsr){
pCsr->iField = 0;
pCsr->bOnePage = 0;
sqlite3_free(pCsr->aPage);
sqlite3_free(pCsr->pRec);
pCsr->pRec = 0;
dbdataBufferFree(&pCsr->rec);
pCsr->aPage = 0;
}
@@ -551,7 +584,7 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
}
}else{
/* If there is no record loaded, load it now. */
if( pCsr->pRec==0 ){
if( pCsr->nRec==0 ){
int bHasRowid = 0;
int nPointer = 0;
sqlite3_int64 nPayload = 0;
@@ -595,6 +628,7 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
}else{
iOff += dbdataGetVarintU32(&pCsr->aPage[iOff], &nPayload);
if( nPayload>0x7fffff00 ) nPayload &= 0x3fff;
if( nPayload==0 ) nPayload = 1;
}
/* If this is a leaf intkey cell, load the rowid */
@@ -629,13 +663,12 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
/* Allocate space for payload. And a bit more to catch small buffer
** overruns caused by attempting to read a varint or similar from
** near the end of a corrupt record. */
pCsr->pRec = (u8*)sqlite3_malloc64(nPayload+DBDATA_PADDING_BYTES);
if( pCsr->pRec==0 ) return SQLITE_NOMEM;
memset(pCsr->pRec, 0, nPayload+DBDATA_PADDING_BYTES);
pCsr->nRec = nPayload;
rc = dbdataBufferSize(&pCsr->rec, nPayload+DBDATA_PADDING_BYTES);
if( rc!=SQLITE_OK ) return rc;
assert( nPayload!=0 );
/* Load the nLocal bytes of payload */
memcpy(pCsr->pRec, &pCsr->aPage[iOff], nLocal);
memcpy(pCsr->rec.aBuf, &pCsr->aPage[iOff], nLocal);
iOff += nLocal;
/* Load content from overflow pages */
@@ -653,19 +686,22 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
nCopy = U-4;
if( nCopy>nRem ) nCopy = nRem;
memcpy(&pCsr->pRec[nPayload-nRem], &aOvfl[4], nCopy);
memcpy(&pCsr->rec.aBuf[nPayload-nRem], &aOvfl[4], nCopy);
nRem -= nCopy;
pgnoOvfl = get_uint32(aOvfl);
sqlite3_free(aOvfl);
}
nPayload -= nRem;
}
memset(&pCsr->rec.aBuf[nPayload], 0, DBDATA_PADDING_BYTES);
pCsr->nRec = nPayload;
iHdr = dbdataGetVarintU32(pCsr->pRec, &nHdr);
iHdr = dbdataGetVarintU32(pCsr->rec.aBuf, &nHdr);
if( nHdr>nPayload ) nHdr = 0;
pCsr->nHdr = nHdr;
pCsr->pHdrPtr = &pCsr->pRec[iHdr];
pCsr->pPtr = &pCsr->pRec[pCsr->nHdr];
pCsr->pHdrPtr = &pCsr->rec.aBuf[iHdr];
pCsr->pPtr = &pCsr->rec.aBuf[pCsr->nHdr];
pCsr->iField = (bHasRowid ? -1 : 0);
}
}
@@ -673,7 +709,7 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
pCsr->iField++;
if( pCsr->iField>0 ){
sqlite3_int64 iType;
if( pCsr->pHdrPtr>=&pCsr->pRec[pCsr->nRec]
if( pCsr->pHdrPtr>=&pCsr->rec.aBuf[pCsr->nRec]
|| pCsr->iField>=DBDATA_MX_FIELD
){
bNextPage = 1;
@@ -681,8 +717,8 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
int szField = 0;
pCsr->pHdrPtr += dbdataGetVarintU32(pCsr->pHdrPtr, &iType);
szField = dbdataValueBytes(iType);
if( (pCsr->nRec - (pCsr->pPtr - pCsr->pRec))<szField ){
pCsr->pPtr = &pCsr->pRec[pCsr->nRec];
if( (pCsr->nRec - (pCsr->pPtr - pCsr->rec.aBuf))<szField ){
pCsr->pPtr = &pCsr->rec.aBuf[pCsr->nRec];
}else{
pCsr->pPtr += szField;
}
@@ -692,20 +728,18 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){
if( bNextPage ){
sqlite3_free(pCsr->aPage);
sqlite3_free(pCsr->pRec);
pCsr->aPage = 0;
pCsr->pRec = 0;
pCsr->nRec = 0;
if( pCsr->bOnePage ) return SQLITE_OK;
pCsr->iPgno++;
}else{
if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->pRec[pCsr->nHdr] ){
if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->rec.aBuf[pCsr->nHdr] ){
return SQLITE_OK;
}
/* Advance to the next cell. The next iteration of the loop will load
** the record and so on. */
sqlite3_free(pCsr->pRec);
pCsr->pRec = 0;
pCsr->nRec = 0;
pCsr->iCell++;
}
}
@@ -895,12 +929,12 @@ static int dbdataColumn(
case DBDATA_COLUMN_VALUE: {
if( pCsr->iField<0 ){
sqlite3_result_int64(ctx, pCsr->iIntkey);
}else if( &pCsr->pRec[pCsr->nRec] >= pCsr->pPtr ){
}else if( &pCsr->rec.aBuf[pCsr->nRec] >= pCsr->pPtr ){
sqlite3_int64 iType;
dbdataGetVarintU32(pCsr->pHdrPtr, &iType);
dbdataValue(
ctx, pCsr->enc, iType, pCsr->pPtr,
&pCsr->pRec[pCsr->nRec] - pCsr->pPtr
&pCsr->rec.aBuf[pCsr->nRec] - pCsr->pPtr
);
}
break;
+549
View File
@@ -0,0 +1,549 @@
# 2024 May 1
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
source [file join [file dirname [info script]] recover_common.tcl]
set testprefix recovercorrupt3
#| 0: d5 d5 9b d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 ................
#| 16: 04 00 00 00 1d 00 00 00 00 00 00 00 5f 5f 5f 5f ............____
#| 32: 5f 5f 5f 5f 5f 5f 5f 5f 71 5f 5f 5f 02 02 02 02 ________q___....
#| 48: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
#| 64: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
#| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
#| 96: 02 02 02 02
#-------------------------------------------------------------------------
reset_db
do_test 1.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 3821 pagesize 1024 filename clusterfuzz-testcase-sql_recovery_fuzzer-5803962339885056
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 01 00 00 00 02 .....@ ........
| 32: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................
| 96: 00 2e 7a 70 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 a0 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 29 29 ..............))
| 464: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 480: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 496: 29 29 29 dd dd dd dd dd dd dd dd dd dd dd dd dd ))).............
| 512: dd dd dd dd dd dd dd dd dd 6e 69 d2 e9 e9 e9 d2 .........ni.....
| 528: d2 d2 d2 d2 dd dd dd dd dd dd dd dd dd dd dd dd ................
| 544: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 560: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 576: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 592: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 608: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 624: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 640: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 656: dd dd dd dd dd dd dd da dd dd dd dd dd dd dd dd ................
| 672: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 688: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 704: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 720: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 736: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 752: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 768: dd dd dd dd dd dd dd dd dd dd dd dd dd 29 29 29 .............)))
| 784: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 800: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 816: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 832: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 848: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 864: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 880: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 896: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 912: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 928: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 944: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 960: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 976: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 992: 29 29 29 29 29 29 29 29 29 29 dd dd dd dd dd dd ))))))))))......
| 1008: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| page 2 offset 1024
| 0: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 16: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 32: dd dd 6e 69 d2 e9 e9 e9 d2 d2 d2 d2 d2 dd dd dd ..ni............
| 48: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 64: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 80: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 96: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 112: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 128: dd dd dd dd dd dd 29 29 29 29 29 29 29 29 29 29 ......))))))))))
| 144: 29 29 29 29 29 29 29 29 29 ad a5 29 29 29 29 00 )))))))))..)))).
| 160: 75 9c 11 00 5b e5 64 28 7c ca 09 69 28 2d 69 00 u...[.d(|..i(-i.
| 176: 85 88 6c 81 48 83 a0 93 c0 c0 82 8b 81 84 85 f9 ..l.H...........
| 192: 88 7a 00 7f 00 96 40 7b 12 4b 84 75 a0 00 99 a0 .z....@..K.u....
| 208: df a0 7e 81 c6 90 8f 7f 84 85 cc 84 82 90 88 60 ..~............`
| 224: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 240: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 256: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 272: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 288: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 752: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 768: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 784: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 800: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 816: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 832: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 848: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 864: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 880: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 896: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 912: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 928: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 944: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 960: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 976: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 992: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 1008: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| page 3 offset 2048
| 0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 16: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 32: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 48: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 64: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 96: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 752: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 768: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 784: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 800: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 816: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 832: 02 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 848: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 864: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 880: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 896: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 912: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 928: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 944: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 960: 80 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 976: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 992: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 1008: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| page 4 offset 3072
| 0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 16: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 32: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 48: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 64: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 96: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 5f 5f 5f 5f 5f 5f 5f 00 d5 fe fe fe 08 00 00 00 _______.........
| end clusterfuzz-testcase-sql_recovery_fuzzer-5803962339885056
}]} {}
sqlite3_dbdata_init db
do_execsql_test 1.1 {
PRAGMA writable_schema = 1;
}
do_test 1.2 {
set R [sqlite3_recover_init db main test.db2]
$R run
$R finish
} {}
#-------------------------------------------------------------------------
reset_db
do_test 2.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
| size 3821 pagesize 1024 filename clusterfuzz-testcase-sql_recovery_fuzzer-5803962339885056
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 04 00 01 01 00 40 20 20 00 00 00 01 00 00 00 02 .....@ ........
| 32: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................
| 96: 00 2e 7a 70 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 a0 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 29 29 ..............))
| 464: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 480: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 496: 29 29 29 dd dd dd dd dd dd dd dd dd dd dd dd dd ))).............
| 512: dd dd dd dd dd dd dd dd dd 6e 69 d2 e9 e9 e9 d2 .........ni.....
| 528: d2 d2 d2 d2 dd dd dd dd dd dd dd dd dd dd dd dd ................
| 544: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 560: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 576: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 592: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 608: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 624: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 640: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 656: dd dd dd dd dd dd dd da dd dd dd dd dd dd dd dd ................
| 672: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 688: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 704: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 720: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 736: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 752: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 768: dd dd dd dd dd dd dd dd dd dd dd dd dd 29 29 29 .............)))
| 784: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 800: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 816: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 832: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 848: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 864: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 880: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 896: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 912: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 928: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 944: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 960: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 976: 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ))))))))))))))))
| 992: 29 29 29 29 29 29 29 29 29 29 dd dd dd dd dd dd ))))))))))......
| 1008: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| page 2 offset 1024
| 0: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 16: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 32: dd dd 6e 69 d2 e9 e9 e9 d2 d2 d2 d2 d2 dd dd dd ..ni............
| 48: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 64: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 80: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 96: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 112: dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd ................
| 128: dd dd dd dd dd dd 29 29 29 29 29 29 29 29 29 29 ......))))))))))
| 144: 29 29 29 29 29 29 29 29 29 ad a5 29 29 29 29 00 )))))))))..)))).
| 160: 75 9c 11 00 5b e5 64 28 7c ca 09 69 28 2d 69 00 u...[.d(|..i(-i.
| 176: 85 88 6c 81 48 83 a0 93 c0 c0 82 8b 81 84 85 f9 ..l.H...........
| 192: 88 7a 00 7f 00 96 40 7b 12 4b 84 75 a0 00 99 a0 .z....@..K.u....
| 208: df a0 7e 81 c6 90 8f 7f 84 85 cc 84 82 90 88 60 ..~............`
| 224: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 240: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 256: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 272: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 288: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 752: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 768: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 784: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 800: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 816: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 832: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 848: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 864: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 880: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 896: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 912: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 928: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 944: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 960: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 976: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 992: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 1008: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| page 3 offset 2048
| 0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 16: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 32: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 48: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 64: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 96: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 752: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 768: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 784: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 800: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 816: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 832: 02 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 848: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 864: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 880: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 896: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 912: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 928: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 944: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ................
| 960: 80 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 976: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 992: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 1008: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| page 4 offset 3072
| 0: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 16: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 32: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 48: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 64: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 80: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 96: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 112: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 128: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 144: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 160: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 176: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 192: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 208: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 224: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 240: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 256: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 272: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 288: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 304: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 320: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 336: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 352: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 368: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 384: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 400: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 416: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 432: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 448: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 464: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 480: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 496: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 512: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 528: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 544: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 560: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 576: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 592: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 608: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 624: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 640: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 656: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 672: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 688: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 704: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 720: 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 ................
| 736: 5f 5f 5f 5f 5f 5f 5f 00 d5 fe fe fe 08 00 00 00 _______.........
| end clusterfuzz-testcase-sql_recovery_fuzzer-5803962339885056
}]} {}
sqlite3_dbdata_init db
do_execsql_test 2.1 {
PRAGMA writable_schema = 1;
}
do_test 2.2 {
set R [sqlite3_recover_init db main test.db2]
$R run
$R finish
} {}
finish_test
+6
View File
@@ -289,6 +289,12 @@ endif
# embedding in the JS files and in building the distribution zip file.
# It must NOT be in $(dir.tmp) because we need it to survive the
# cleanup process for the dist build to work properly.
#
# Slight caveat: this uses the version info from the in-tree
# sqlite3.c/h, which may diff from a user-provided $(sqlite3.c). The
# end result is that the generated JS files may have static version
# info from $(bin.version-info) which differ from their runtime-emited
# version info (e.g. from sqlite3_libversion()).
bin.version-info := $(dir.top)/version-info
.NOTPARALLEL: $(bin.version-info)
$(bin.version-info): $(dir.tool)/version-info.c $(sqlite3.h) $(dir.top)/Makefile
+34 -12
View File
@@ -1382,15 +1382,19 @@ globalThis.WhWasmUtilInstaller = function(target){
conversion of argument or return types, but see xWrap() and
xCallWrapped() for variants which do.
If the first argument is a function is is assumed to be
a WASM-bound function and is used as-is instead of looking up
the function via xGet().
As a special case, if passed only 1 argument after the name and
that argument in an Array, that array's entries become the
function arguments. (This is not an ambiguous case because it's
not legal to pass an Array object to a WASM function.)
*/
target.xCall = function(fname, ...args){
const f = target.xGet(fname);
const f = (fname instanceof Function) ? fname : target.xGet(fname);
if(!(f instanceof Function)) toss("Exported symbol",fname,"is not a function.");
if(f.length!==args.length) __argcMismatch(fname,f.length)
if(f.length!==args.length) __argcMismatch(((f===fname) ? f.name : fname),f.length)
/* This is arguably over-pedantic but we want to help clients keep
from shooting themselves in the foot when calling C APIs. */;
return (2===arguments.length && Array.isArray(arguments[1]))
@@ -1537,7 +1541,7 @@ globalThis.WhWasmUtilInstaller = function(target){
jsFuncToWasm().
- bindScope (string): one of ('transient', 'context',
'singleton'). Bind scopes are:
'singleton', 'permanent'). Bind scopes are:
- 'transient': it will convert JS functions to WASM only for
the duration of the xWrap()'d function call, using
@@ -1787,11 +1791,29 @@ globalThis.WhWasmUtilInstaller = function(target){
const __xResultAdapterCheck =
(t)=>xResult.get(t) || toss("Result adapter not found:",t);
/**
Fetches the xWrap() argument adapter mapped to t, calls it,
passing in all remaining arguments, and returns the result.
Throws if t is not mapped to an argument converter.
*/
cache.xWrap.convertArg = (t,...args)=>__xArgAdapterCheck(t)(...args);
/**
Identical to convertArg() except that it does not perform
an is-defined check on the mapping to t before invoking it.
*/
cache.xWrap.convertArgNoCheck = (t,...args)=>xArg.get(t)(...args);
/**
Fetches the xWrap() result adapter mapped to t, calls it, passing
it v, and returns the result. Throws if t is not mapped to an
argument converter.
*/
cache.xWrap.convertResult =
(t,v)=>(null===t ? v : (t ? __xResultAdapterCheck(t)(v) : undefined));
/**
Identical to convertResult() except that it does not perform an
is-defined check on the mapping to t before invoking it.
*/
cache.xWrap.convertResultNoCheck =
(t,v)=>(null===t ? v : (t ? xResult.get(t)(v) : undefined));
@@ -1903,15 +1925,15 @@ globalThis.WhWasmUtilInstaller = function(target){
const C-string, encoded as UTF-8, copies it to a JS string,
and returns that JS string.
- `string:dealloc` or `utf8:dealloc) (results): treats the result value
as a non-const UTF-8 C-string, ownership of which has just been
transfered to the caller. It copies the C-string to a JS
string, frees the C-string, and returns the JS string. If such
a result value is NULL, the JS result is `null`. Achtung: when
using an API which returns results from a specific allocator,
e.g. `my_malloc()`, this conversion _is not legal_. Instead, an
equivalent conversion which uses the appropriate deallocator is
required. For example:
- `string:dealloc` or `utf8:dealloc` (results): treats the result
value as a non-const UTF-8 C-string, ownership of which has
just been transfered to the caller. It copies the C-string to a
JS string, frees the C-string, and returns the JS string. If
such a result value is NULL, the JS result is `null`. Achtung:
when using an API which returns results from a specific
allocator, e.g. `my_malloc()`, this conversion _is not
legal_. Instead, an equivalent conversion which uses the
appropriate deallocator is required. For example:
```js
target.xWrap.resultAdapter('string:my_free',(i)=>{
+25 -22
View File
@@ -1,5 +1,5 @@
C Further\simprovements\sto\sthe\scomputation\sof\saffinity\sfor\scompound\ssubqueries:\nmake\ssure\sthat\sthe\sselected\saffinity\sis\scompatible\swith\sa\sliteral\svalues\sin\narms\sto\sthe\sleft\sof\sthe\sarm\sthat\sis\sused\sto\sdetermine\saffinity.
D 2024-04-25T17:52:10.004
C Assume\sthat\sa\sfunction\sis\sable\sto\sreturn\sa\ssubtype\sif\seither\s(1)\sit\sis\sitself\nmarked\swith\sSQLITE_RESULT_SUBTYPE,\sor\s(2)\sone\sof\sits\sarguments\sis\sa\sfunction\nthat\sis\sable\sto\sreturn\sa\ssubtype.\s\sThis\scheck-in\sbacks\sout\sthe\scode\schanges\nfrom\sthe\sprevious\stwo\son\sthis\ssame\sbranch,\sbut\skeeps\sthe\stest\scases\sfrom\nthe\sprevious\stwo.
D 2024-05-04T15:04:45.707
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -411,7 +411,7 @@ F ext/misc/regexp.c 4bdd0045912f81c84908bd535ec5ad3b1c8540b4287c70ab840709636240
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
F ext/misc/series.c 384f93a8a09cf45e1aa6575660cb580ed61d372c590aad05cdcd4a84fbd8f6ab
F ext/misc/series.c d96e5aac21658c6b5d54f918ac140460ec7197734c1a4fba806950831a7b1e7a
F ext/misc/sha1.c 4011aef176616872b2a0d5bccf0ecfb1f7ce3fe5c3d107f3a8e949d8e1e3f08d
F ext/misc/shathree.c 543af7ce71d391cd3a9ab6924a6a1124efc63211fd0f2e240dc4b56077ba88ac
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
@@ -478,13 +478,14 @@ F ext/rbu/rbuvacuum4.test ffccd22f67e2d0b380d2889685742159dfe0d19a3880ca3d2d1d69
F ext/rbu/sqlite3rbu.c 4a3376c0fb9a844a799ac529fb81260523f6b13c9f629bc270c632dbae5fc1f8
F ext/rbu/sqlite3rbu.h 9d923eb135c5d04aa6afd7c39ca47b0d1d0707c100e02f19fdde6a494e414304
F ext/rbu/test_rbu.c ee6ede75147bc081fe9bc3931e6b206277418d14d3fbceea6fdc6216d9b47055
F ext/recover/dbdata.c d2e00d3cac74319c9c6def2e56ab2146b4f4ba5d820ab275e8da24e9766c247e
F ext/recover/dbdata.c e518c1a221a259a1ea594d9db8fce356861bfa450e6f54eda999242b9bd5c50a
F ext/recover/recover1.test c484d01502239f11b61f23c1cee9f5dd19fa17617f8974e42e74d64639c524cf
F ext/recover/recover_common.tcl a61306c1eb45c0c3fc45652c35b2d4ec19729e340bdf65a272ce4c229cefd85a
F ext/recover/recoverbuild.test c74170e0f7b02456af41838afeb5353fdb985a48cc2331d661bbabbca7c6b8e3
F ext/recover/recoverclobber.test 3ba6c0c373c5c63d17e82eced64c05c57ccaf26c1abe1ca7141334022a79f32e
F ext/recover/recovercorrupt.test 64c081ad1200ae77b447da99eb724785d6bf71715f394543dc7689642e92bf49
F ext/recover/recovercorrupt2.test 1418f1710debc24ff38276cedfcea234beb37a34205708e7e3e6d76cc4a979db
F ext/recover/recovercorrupt3.test 2e7b9a1b528ca23ed382cec6f64e3fcbbd0f8e852add7562397fd8df83f335d5
F ext/recover/recoverfault.test 9d9f88eeb222615a25e7514f234c950d46bee20d24cd8db49d8fff8d650dcfe1
F ext/recover/recoverfault2.test 730e7371bcda769554d15460cb23126abba1be8eca9539ccabf63623e7bb7e09
F ext/recover/recoverold.test 68db3d6f85dd2b98e785b6c4da4f5eea4bbe52ccf6674d9a94c7506dc92596aa
@@ -588,7 +589,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 0d5ccc8a4814716c1c789bb3069dd4d71d5ef0a97bbea074ac182fbfb85a3ca8
F ext/wasm/GNUmakefile 21f015f342e4ed9b7ff632c10750512259d26c836a34f4f535673fae9a7c9fcc
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@@ -627,7 +628,7 @@ F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
F ext/wasm/common/whwasmutil.js 4c64594eecc7af4ae64259e95a71ba2a7edf118881aaff0bba86d0c7164e78e4
F ext/wasm/common/whwasmutil.js e474e0fac695abf88e5385581e26d53e5706cd268cab9d92a56eab2873c08daa
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32e7be5bf
@@ -693,7 +694,7 @@ F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
F src/btree.c 71b80e77b255144db47180fda8138740608e382a44231942464029b1a45fc036
F src/btree.h 55066f513eb095db935169dab1dc2f7c7a747ef223c533f5d4ad4dfed346cbd0
F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6
F src/build.c 02f5b25ca854c83b5015cb02b8c9ab236c60b1795528675aee8a5070e58da52a
F src/build.c 11ec7014a3c468e7b3ccc8dda8d9111cd5a29a358df18818788601e0600aaabd
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 64e4b1227b4ed123146f0aa2989131d1fbd9b927b11e80c9d58c6a68f9cd5ce3
@@ -744,12 +745,12 @@ F src/parse.y 5bcef16094213efcc365a9d4dc4e3131f09251dc8838dce4a9e5f9764bff5b82
F src/pcache.c 040b165f30622a21b7a9a77c6f2e4877a32fb7f22d4c7f0d2a6fa6833a156a75
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 602acb23c471bb8d557a6f0083cc2be641d6cafcafa19e481eba7ef4c9ca0f00
F src/pragma.c f8f1845b42df684e9d31c5a1628c989a34939686049d7878bc5394ac1ae9cac4
F src/pragma.c d357a25276d222adfd4637c48880409ec4539f30844b74001c6ba5c7d1a1f0f7
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
F src/prepare.c 371f6115cb69286ebc12c6f2d7511279c2e47d9f54f475d46a554d687a3b312c
F src/printf.c 8b250972305e14b365561be5117ed0fd364e4fd58968776df1ce64c6280b90f9
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 647edf93729ba124c0a6048982af56c2fa4f841e69d626e4f3caa620f082bb15
F src/resolve.c 8816212645e4e9bdf3cc2f2d298304f388d699f8fab47f3a5712ef5bbc5b6ccc
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 04178566d0188be7de471064ced8cec1d407920726cb49b609486282d78faf56
F src/shell.c.in 0354ca51eee5fbf6af394a7ef9f5ef6823ef45b743db65431f6777e4d5be2199
@@ -814,7 +815,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 3f703cacdab728d7741e5a6ac242006d74fe1c2754d4f03ed889d7253259bd68
F src/treeview.c a8aa3086c886c6eb2ff2b6354b0f23d251f7219bf08fad52d4f2791e55324f1b
F src/treeview.c 4f9ba6c1c7c9893fc046fdb0bc1f6bdec7660122b1ae37e51fb9b64c286caafd
F src/trigger.c 0858f75818ed1580332db274f1032bcc5effe567cb132df5c5be8b1d800ca97f
F src/update.c 732404a04d1737ef14bb6ec6b84f74edf28b3c102a92ae46b4855438a710efe7
F src/upsert.c 2e60567a0e9e8520c18671b30712a88dc73534474304af94f32bb5f3ef65ac65
@@ -830,16 +831,16 @@ F src/vdbeblob.c 13f9287b55b6356b4b1845410382d6bede203ceb29ef69388a4a3d007ffacbe
F src/vdbemem.c 385c8b89da3b5ef9a468d77a466958aa72ee1212d5cb005f23ec63df1d413054
F src/vdbesort.c 237840ca1947511fa59bd4e18b9eeae93f2af2468c34d2427b059f896230a547
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c 2143db7db0ceed69b21422581f434baffc507a08d831565193a7a02882a1b6a7
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
F src/vtab.c 4c475fb672a6fe57830561e614dbee21a9a24a6f616d1cfcbe85f356a09f14ad
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 887fc4ca3f020ebb2e376f222069570834ac63bf50111ef0cbf3ae417048ed89
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c 7c7ea0115345851c3da4e04e2e239a29983b61fb5b038b94eede6aba462640e2
F src/where.c 447d8761632fb0a18b03077161415d9713cbd0a81bf34a35cee63480e5c401c5
F src/where.c d235ba520b0147f60732b3bd411e119b43be33d348251edaa6e304a8ad52c511
F src/whereInt.h 82a13766f13d1a53b05387c2e60726289ef26404bc7b9b1f7770204d97357fb8
F src/wherecode.c 1f6940349e92a6e056aecd70163b00f331554c815c362b4cc80906c48151d73d
F src/whereexpr.c 7b64295f1d82ad0928df435925dd7bbd5997b44a026153113eace0d9e71ff435
F src/wherecode.c b9908c0a1aab095822a1e7032556bedc03b6d29641191e9ca535fb2307cd733d
F src/whereexpr.c 67d15caf88a1a9528283d68ff578e024cf9fe810b517bb0343e5aaf695ad97dd
F src/window.c 5d95122dd330bfaebd732358c8ef067c5a9394a53ac249470d611d0ce2c52be2
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test ce1aafc86e110685b324e9a763eab4f2a73f737842ec3b687bd965867de90627
@@ -932,10 +933,11 @@ F test/bestindex4.test 3039894f2dad50f3a68443dffad1b44c9b067ac03870102df1ce3d9a4
F test/bestindex5.test a0c90b2dad7836e80a01379e200e5f8ec9476d49b349af02c0dbff2fb75dc98d
F test/bestindex6.test 16942535b551273f3ad9df8d7cc4b7f22b1fcd8882714358859eb049a6f99dd4
F test/bestindex7.test f094c669a6400777f4d2ddc3ed28e39169f1adb5be3d59b55f22ccf8c414b71e
F test/bestindex8.test 333ad8c6a554b885a49b68c019166eda92b05f493a92b36b0acdf7f766d04dad
F test/bestindex8.test b63a4f171a2c83d481bb14c431a8b72e85d27b2ffdaa0435a95d58ca941678f9
F test/bestindex9.test 1a4b93db117fd8abe74ae9be982f86aa72f01e60cd4ac541e6ede39673a451a0
F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572eef44c7f
F test/bestindexB.test 328b97b69cd1a20928d5997f9ecb04d2e00f1d18e19ab27f9e9adb44d7bc51ce
F test/bestindexC.test c14a8c8639b6825b0efa1ae693f34ec04f41a46e3056e7063d6e0f46bf4ff692
F test/between.test b9a65fb065391980119e8a781a7409d3fcf059d89968279c750e190a9a1d5263
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
@@ -1277,6 +1279,7 @@ F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
F test/in4.test bb767ec1cfd1730256f0a83219f0acda36bc251b63f8b8bb7d8c7cff17875a4f
F test/in5.test 4fd79c70dfa0681313e8cdca07f5ff0400bdc0e20f808a5c59eaef1e4b48082a
F test/in6.test f5f40d6816a8bb7c784424b58a10ac38efb76ab29127a2c17399e0cbeeda0e4b
F test/in7.test b3a87d5e4f608ac9787e707fc4f8f2a0d89359489d109fdcac01470c3a6832f4
F test/incrblob.test c9b96afc292aeff43d6687bcb09b0280aa599822
F test/incrblob2.test a494c9e848560039a23974b9119cfc2cf3ad3bd15cc2694ee6367ae537ef8f1f
F test/incrblob3.test 67621a04b3084113bf38ce03797d70eca012d9d8f948193b8f655df577b0da6f
@@ -1299,7 +1302,7 @@ F test/index8.test caa097735c91dbc23d8a402f5e63a2a03c83840ba3928733ed7f9a03f8a91
F test/index9.test 2ac891806a4136ef3e91280477e23114e67575207dc331e6797fa0ed9379f997
F test/indexA.test 11d84f6995e6e5b9d8315953fb1b6d29772ee7c7803ee9112715e7e4dd3e4974
F test/indexedby.test f21eca4f7a6ffe14c8500a7ad6cd53166666c99e5ccd311842a28bc94a195fe0
F test/indexexpr1.test 833f511213a5e26549186813f0566bd72f978177a7e6e98a2d2dd695de3c670d
F test/indexexpr1.test 24fa85a12da384dd1d56f7b24e593c51a8a54b4c5e2e8bbb9e5fdf1099427faf
F test/indexexpr2.test 1c382e81ef996d8ae8b834a74f2a9013dddf59214c32201d7c8a656d739f999a
F test/indexfault.test 98d78a8ff1f5335628b62f886a1cb7c7dac1ef6d48fa39c51ec871c87dce9811
F test/init.test 15c823093fdabbf7b531fe22cf037134d09587a7
@@ -1499,7 +1502,7 @@ F test/pendingrace.test 6aa33756b950c4529f79c4f3817a9a1e4025bd0d9961571a05c0279b
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 405542f1d659942994a6b38a9e024cf5cfd23eaa68c806aeb24a72d7c9186e80
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
F test/pragma.test 8bb6d3992c1c31ff6d5553d1e0693d642f7e19015648c6ae7034cb497d26bbd4
F test/pragma.test 11cb9310c42f921918f7f563e3c0b6e70f9f9c3a6a1cf12af8fccb6c574f3882
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31
F test/pragma4.test 22834a228e59b80f5c15b519b710474859d91535002670ddb7cd13ac44b54e9a
@@ -1530,7 +1533,7 @@ F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed13
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/resetdb.test 54c06f18bc832ac6d6319e5ab23d5c8dd49fdbeec7c696d791682a8006bd5fc3
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/returning1.test 2ebfe6e56f3de9b194295620f46a747c26cebdab937defb9afd84b96dd202ccb
F test/returning1.test 38eee9d07ac1dd4fbd4ce7373497f3783db86b9a76f13ea6a9f9afaf934f888b
F test/returningfault.test ae4c4b5e8745813287a359d9ccdb9d5c883c2e68afb18fb0767937d5de5692a4
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
F test/rollback2.test 3f3a4e20401825017df7e7671e9f31b6de5fae5620c2b9b49917f52f8c160a8f
@@ -1678,7 +1681,7 @@ F test/sync.test 89539f4973c010eda5638407e71ca7fddbcd8e0594f4c9980229f804d433309
F test/sync2.test 8f9f7d4f6d5be8ca8941a8dadcc4299e558cb6a1ff653a9469146c7a76ef2039
F test/syscall.test a39d9a36f852ae6e4800f861bc2f2e83f68bbc2112d9399931ecfadeabd2d69d
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test 54f27eacd054aa528a8b6e3331192c484104f30aaee351ad035f2b39a00f87c4
F test/tabfunc01.test f150d206294471d20f50029e6b46b76b87a7a010b16dc57eb44245c76dd02802
F test/table.test 7862a00b58b5541511a26757ea9c5c7c3f8298766e98aa099deec703d9c0a8e0
F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@@ -2185,8 +2188,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P b8ec8511b1968bbc1472b3e2e21f0fef1d5becebeb31f9d13ee3ca9e13abb1e5
R a7fab6239835ca1909d168c0371f9e50
P 2f9fba931d9f80b3d5dffb175180098756bccc6a8f665d7aaf8826970ab60d72
R 14886039188c50fb101aa25afbe73592
U drh
Z 0a86570527084dd8d6c773960419770f
Z 80e41ac2288666eefe08d1c7b25daa7c
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
bbdf22e3d989f42b963f1f2f219dfeac11db786f17ac27097ab72f72e7638a2a
f16b200f25a0ec59ad765d254d81c3ffdba21f79e6e82807a7b80d00627952e2
-3
View File
@@ -2927,9 +2927,6 @@ void sqlite3EndTable(
sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0,
sqlite3MPrintf(db, "PRAGMA \"%w\".integrity_check(%Q)",
db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC);
}
/* Add the table to the in-memory representation of the database.
+1 -1
View File
@@ -1703,7 +1703,7 @@ void sqlite3Pragma(
/* Set the maximum error count */
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
if( zRight ){
if( sqlite3GetInt32(zRight, &mxErr) ){
if( sqlite3GetInt32(pValue->z, &mxErr) ){
if( mxErr<=0 ){
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
}
+2 -1
View File
@@ -528,7 +528,8 @@ static int lookupName(
if( pParse->bReturning ){
if( (pNC->ncFlags & NC_UBaseReg)!=0
&& ALWAYS(zTab==0
|| sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
|| sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0
|| isValidSchemaTableName(zTab, pParse->pTriggerTab, 0))
){
pExpr->iTable = op!=TK_DELETE;
pTab = pParse->pTriggerTab;
+1 -1
View File
@@ -346,7 +346,7 @@ void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
if( p->pLimit->pRight ){
sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
sqlite3TreeViewItem(pView, "OFFSET", 0);
sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
sqlite3TreeViewPop(&pView);
}
+2 -2
View File
@@ -286,10 +286,10 @@ static int bytecodevtabColumn(
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
case 9: /* nexec */
sqlite3_result_int(ctx, pOp->nExec);
sqlite3_result_int64(ctx, pOp->nExec);
break;
case 10: /* ncycle */
sqlite3_result_int(ctx, pOp->nCycle);
sqlite3_result_int64(ctx, pOp->nCycle);
break;
#else
case 9: /* nexec */
+80 -14
View File
@@ -4057,6 +4057,21 @@ static int isLimitTerm(WhereTerm *pTerm){
&& pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET;
}
/*
** Return true if the first nCons constraints in the pUsage array are
** marked as in-use (have argvIndex>0). False otherwise.
*/
static int allConstraintsUsed(
struct sqlite3_index_constraint_usage *aUsage,
int nCons
){
int ii;
for(ii=0; ii<nCons; ii++){
if( aUsage[ii].argvIndex<=0 ) return 0;
}
return 1;
}
/*
** Argument pIdxInfo is already populated with all constraints that may
** be used by the virtual table identified by pBuilder->pNew->iTab. This
@@ -4197,13 +4212,20 @@ static int whereLoopAddVirtualOne(
*pbIn = 1; assert( (mExclude & WO_IN)==0 );
}
/* Unless pbRetryLimit is non-NULL, there should be no LIMIT/OFFSET
** terms. And if there are any, they should follow all other terms. */
assert( pbRetryLimit || !isLimitTerm(pTerm) );
if( isLimitTerm(pTerm) && *pbIn ){
assert( !isLimitTerm(pTerm) || i>=nConstraint-2 );
assert( !isLimitTerm(pTerm) || i==nConstraint-1 || isLimitTerm(pTerm+1) );
if( isLimitTerm(pTerm) && (*pbIn || !allConstraintsUsed(pUsage, i)) ){
/* If there is an IN(...) term handled as an == (separate call to
** xFilter for each value on the RHS of the IN) and a LIMIT or
** OFFSET term handled as well, the plan is unusable. Set output
** variable *pbRetryLimit to true to tell the caller to retry with
** LIMIT and OFFSET disabled. */
** OFFSET term handled as well, the plan is unusable. Similarly,
** if there is a LIMIT/OFFSET and there are other unused terms,
** the plan cannot be used. In these cases set variable *pbRetryLimit
** to true to tell the caller to retry with LIMIT and OFFSET
** disabled. */
if( pIdxInfo->needToFreeIdxStr ){
sqlite3_free(pIdxInfo->idxStr);
pIdxInfo->idxStr = 0;
@@ -5967,6 +5989,58 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful(
}
}
/*
** Expression Node callback for sqlite3ExprCanReturnSubtype().
**
** Only a function call is able to return a subtype. So if the node
** is not a function call, return WRC_Prune immediately.
**
** A function call is able to return a subtype if it has the
** SQLITE_RESULT_SUBTYPE property.
**
** Assume that every function is able to pass-through a subtype from
** one of its argument (using sqlite3_result_value()). Most functions
** are not this way, but we don't have a mechanism to distinguish those
** that are from those that are not, so assume they all work this way.
** That means that if one of its arguments is another function and that
** other function is able to return a subtype, then this function is
** able to return a subtype.
*/
static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){
int n;
FuncDef *pDef;
sqlite3 *db;
if( pExpr->op!=TK_FUNCTION ){
return WRC_Prune;
}
assert( ExprUseXList(pExpr) );
db = pWalker->pParse->db;
n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
pWalker->eCode = 1;
return WRC_Prune;
}
return WRC_Continue;
}
/*
** Return TRUE if expression pExpr is able to return a subtype.
**
** A TRUE return does not guarantee that a subtype will be returned.
** It only indicates that a subtype return is possible. False positives
** are acceptable as they only disable an optimization. False negatives,
** on the other hand, can lead to incorrect answers.
*/
static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){
Walker w;
memset(&w, 0, sizeof(w));
w.pParse = pParse;
w.xExprCallback = exprNodeCanReturnSubtype;
sqlite3WalkExpr(&w, pExpr);
return w.eCode;
}
/*
** The index pIdx is used by a query and contains one or more expressions.
** In other words pIdx is an index on an expression. iIdxCur is the cursor
@@ -6000,19 +6074,11 @@ static SQLITE_NOINLINE void whereAddIndexedExpr(
continue;
}
if( sqlite3ExprIsConstant(0,pExpr) ) continue;
if( pExpr->op==TK_FUNCTION ){
if( pExpr->op==TK_FUNCTION && sqlite3ExprCanReturnSubtype(pParse,pExpr) ){
/* Functions that might set a subtype should not be replaced by the
** value taken from an expression index since the index omits the
** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */
int n;
FuncDef *pDef;
sqlite3 *db = pParse->db;
assert( ExprUseXList(pExpr) );
n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0;
pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0);
if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){
continue;
}
continue;
}
p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr));
if( p==0 ) break;
+24 -1
View File
@@ -1337,6 +1337,27 @@ static SQLITE_NOINLINE void filterPullDown(
}
}
/*
** Loop pLoop is a WHERE_INDEXED level that uses at least one IN(...)
** operator. Return true if level pLoop is guaranteed to visit only one
** row for each key generated for the index.
*/
static int whereLoopIsOneRow(WhereLoop *pLoop){
if( pLoop->u.btree.pIndex->onError
&& pLoop->nSkip==0
&& pLoop->u.btree.nEq==pLoop->u.btree.pIndex->nKeyCol
){
int ii;
for(ii=0; ii<pLoop->u.btree.nEq; ii++){
if( pLoop->aLTerm[ii]->eOperator & (WO_IS|WO_ISNULL) ){
return 0;
}
}
return 1;
}
return 0;
}
/*
** Generate code for the start of the iLevel-th loop in the WHERE clause
** implementation described by pWInfo.
@@ -2084,7 +2105,9 @@ Bitmask sqlite3WhereCodeOneLoopStart(
}
/* Record the instruction used to terminate the loop. */
if( pLoop->wsFlags & WHERE_ONEROW ){
if( (pLoop->wsFlags & WHERE_ONEROW)
|| (pLevel->u.in.nIn && regBignull==0 && whereLoopIsOneRow(pLoop))
){
pLevel->op = OP_Noop;
}else if( bRev ){
pLevel->op = OP_Prev;
+6 -3
View File
@@ -1638,6 +1638,7 @@ void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Select *p){
continue;
}
if( pWC->a[ii].leftCursor!=iCsr ) return;
if( pWC->a[ii].prereqRight!=0 ) return;
}
/* Check condition (5). Return early if it is not met. */
@@ -1652,12 +1653,14 @@ void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Select *p){
/* All conditions are met. Add the terms to the where-clause object. */
assert( p->pLimit->op==TK_LIMIT );
whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft,
iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT);
if( p->iOffset>0 ){
if( p->iOffset!=0 && (p->selFlags & SF_Compound)==0 ){
whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight,
iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET);
}
if( p->iOffset==0 || (p->selFlags & SF_Compound)==0 ){
whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft,
iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT);
}
}
}
+1 -1
View File
@@ -158,7 +158,7 @@ do_test 2.2 {
set ::lFilterArgs [list]
execsql { SELECT * FROM vt1 LIMIT 5 OFFSET 50 }
set ::lFilterArgs
} {{5 50}}
} {{50 5}}
do_test 2.3 {
set ::lFilterArgs [list]
+178
View File
@@ -0,0 +1,178 @@
# 2024-04-26
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix bestindexC
ifcapable !vtab {
finish_test
return
}
register_tcl_module db
proc vtab_command {lVal method args} {
switch -- $method {
xConnect {
return "CREATE TABLE t1(a)"
}
xBestIndex {
set hdl [lindex $args 0]
set clist [$hdl constraints]
set orderby [$hdl orderby]
set idxstr [list]
set res [list]
set idx 0
foreach c $clist {
array set a $c
if {$a(usable)==0} continue
if {$a(op)=="limit" && ![info exists ::do_not_use_limit]} {
lappend idxstr limit
lappend res omit $idx
}
if {$a(op)=="offset" && ![info exists ::do_not_use_offset]} {
lappend idxstr offset
lappend res omit $idx
}
incr idx
}
return "cost 1000000 rows 1000000 idxnum 0 idxstr {$idxstr} $res"
}
xFilter {
set idxstr [lindex $args 1]
set LIMIT ""
foreach a $idxstr b [lindex $args 2] {
set x($a) $b
}
if {![info exists x(limit)]} { set x(limit) -1 }
if {![info exists x(offset)]} { set x(offset) -1 }
set LIMIT " LIMIT $x(limit) OFFSET $x(offset)"
set idx 1
foreach v $lVal {
lappend lRow "($idx, '$v')"
incr idx
}
return [list sql "
SELECT * FROM ( VALUES [join $lRow ,]) $LIMIT
"]
}
}
return {}
}
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE x1 USING tcl(vtab_command "a b c d e f");
CREATE VIRTUAL TABLE x2 USING tcl(vtab_command "A B C D E F a b");
} {}
do_execsql_test 1.1 {
CREATE TEMP TABLE t_unionall AS
SELECT * FROM x1 UNION ALL SELECT * FROM x2;
CREATE TEMP TABLE t_intersect AS
SELECT * FROM x1 INTERSECT SELECT * FROM x2;
CREATE TEMP TABLE t_union AS
SELECT * FROM x1 UNION SELECT * FROM x2;
CREATE TEMP TABLE t_except AS
SELECT * FROM x1 EXCEPT SELECT * FROM x2;
}
foreach {tn limit} {
1 "LIMIT 8"
2 "LIMIT 4"
3 "LIMIT 4 OFFSET 2"
4 "LIMIT 8 OFFSET 4"
} {
foreach {op tbl} {
"UNION ALL" t_unionall
"UNION" t_union
"INTERSECT" t_intersect
"EXCEPT" t_except
} {
set expect [execsql "SELECT * FROM $tbl $limit"]
do_execsql_test 1.2.$tbl.$tn "SELECT * FROM (
SELECT * FROM x1 $op SELECT * FROM x2
) $limit" $expect
}
}
#-------------------------------------------------------------------------
reset_db
register_tcl_module db
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE x1 USING tcl(vtab_command "a b c d e f");
CREATE VIRTUAL TABLE x2 USING tcl(vtab_command "a b e f");
} {}
do_execsql_test 2.1 {
SELECT * FROM x1
EXCEPT
SELECT * FROM x2
LIMIT 3
} {c d}
#-------------------------------------------------------------------------
reset_db
register_tcl_module db
do_execsql_test 3.0 {
CREATE VIRTUAL TABLE y1 USING tcl(vtab_command "1 2 3 4 5 6 7 8 9 10");
} {}
do_execsql_test 3.1 {
SELECT * FROM y1 WHERE a = COALESCE('8', a) LIMIT 3
} {8}
do_execsql_test 3.2 {
SELECT * FROM y1 WHERE a = '2' LIMIT 3
} {2}
load_static_extension db series
do_execsql_test 3.3 {
SELECT * FROM generate_series(1, 5) WHERE value = (value & 14) LIMIT 3
} {2 4}
do_execsql_test 3.4 {
SELECT value FROM generate_series(1,10) WHERE value>2 LIMIT 4 OFFSET 1;
} {4 5 6 7}
set ::do_not_use_limit 1
do_execsql_test 3.5 {
SELECT * FROM y1 LIMIT 5 OFFSET 3
} {4 5 6 7 8}
unset ::do_not_use_limit
set ::do_not_use_offset 1
do_execsql_test 3.6 {
SELECT * FROM y1 LIMIT 5 OFFSET 3
} {4 5 6 7 8}
unset ::do_not_use_offset
finish_test
+120
View File
@@ -0,0 +1,120 @@
# 2024-05-01
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix in7
do_execsql_test 1.0 {
CREATE TABLE t1(a, b, c PRIMARY KEY);
CREATE TABLE t2(x, y, z);
}
foreach {tn nNext idx sql} {
1 1 {
CREATE INDEX i1 ON t1(a, b);
} {
SELECT * FROM t1 WHERE (a, b) IN (SELECT x, y FROM t2)
}
2 0 {
CREATE UNIQUE INDEX i1 ON t1(a, b);
} {
SELECT * FROM t1 WHERE (a, b) IN (SELECT x, y FROM t2)
}
3 0 {
CREATE UNIQUE INDEX i1 ON t1(a, b);
} {
SELECT * FROM t1 WHERE a = ? AND b = ?
}
3 1 {
CREATE UNIQUE INDEX i1 ON t1(a, b);
} {
SELECT * FROM t1 WHERE a = ? AND b IS ?
}
4 0 {
CREATE UNIQUE INDEX i1 ON t1(a, b);
} {
SELECT * FROM t1 WHERE a = ? AND b IN (?, ?, ?);
}
5 1 {
CREATE UNIQUE INDEX i1 ON t1(a, b, c);
} {
SELECT * FROM t1 WHERE a = ? AND b = ?
}
6 0 {
} {
SELECT * FROM t1 WHERE c IN (SELECT z FROM t2)
}
7 0 {
} {
SELECT * FROM t1 WHERE (a, c) IN (SELECT z, x FROM t2)
}
8 1 {
} {
SELECT * FROM t1 WHERE a IN (SELECT z FROM t2)
}
} {
do_test 1.1.$tn {
execsql BEGIN
execsql $idx
catch { array unset root_to_tbl }
catch { array unset csr_to_root }
db eval {SELECT rootpage, tbl_name FROM sqlite_schema} {
set root_to_tbl($rootpage) $tbl_name
}
set nSeen 0
db eval "explain $sql" {
if {$opcode=="OpenRead"} {
set csr_to_root($p1) $p2
}
if {$opcode=="Next"} {
catch {
set root $csr_to_root($p1)
set tbl $root_to_tbl($root)
if {$tbl=="t1"} {incr nSeen}
}
}
}
execsql ROLLBACK
set nSeen
} $nNext
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 2.0 {
CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT) WITHOUT ROWID;
INSERT INTO t1 VALUES('1', 'one');
INSERT INTO t1 VALUES('2', NULL);
INSERT INTO t1 VALUES('3', 'three');
}
do_execsql_test 2.1 {
SELECT b FROM t1 WHERE a IN (1,2,3) ORDER BY b ASC NULLS LAST;
} {one three {}}
finish_test
+52
View File
@@ -615,6 +615,58 @@ do_execsql_test indexexpr1-2200 {
GROUP BY t2.type, t1.tag
) v ON v.type = 0 AND v.tag = u.tag;
} {7 100 8 101}
do_execsql_test indexexpr1-2210 {
DROP TABLE t1;
CREATE TABLE t1(x INT, y TEXT);
INSERT INTO t1(x,y) VALUES(1,'{b:5}');
SELECT json_insert('{}', '$.a', coalesce(null,json(y)))->>'$.a.b' FROM t1;
} {5}
db null NULL
do_execsql_test indexexpr1-2211 {
CREATE INDEX t1j ON t1(coalesce(null,json(y)));
SELECT json_insert('{}', '$.a', coalesce(null,json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2220 {
DROP INDEX t1j;
SELECT json_insert('{}', '$.a', iif(1,json(y),123))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2221 {
CREATE INDEX t1j ON t1(iif(1,json(y),123));
SELECT json_insert('{}', '$.a', iif(1,json(y),123))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2230 {
DROP INDEX t1j;
SELECT json_insert('{}', '$.a', ifnull(NULL,json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2231 {
CREATE INDEX t1j ON t1(ifnull(NULL,json(y)));
SELECT json_insert('{}', '$.a', ifnull(NULL,json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2240 {
DROP INDEX t1j;
SELECT json_insert('{}', '$.a', nullif(json(y),8))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2241 {
CREATE INDEX t1j ON t1(nullif(json(y),8));
SELECT json_insert('{}', '$.a', nullif(json(y),8))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2250 {
DROP INDEX t1j;
SELECT json_insert('{}', '$.a', min('~',json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2251 {
CREATE INDEX t1j ON t1(min('~',json(y)));
SELECT json_insert('{}', '$.a', min('~',json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2260 {
DROP INDEX t1j;
SELECT json_insert('{}', '$.a', max('...',json(y)))->>'$.a.b' FROM t1;
} {5}
do_execsql_test indexexpr1-2261 {
CREATE INDEX t1j ON t1(max('...',json(y)));
SELECT json_insert('{}', '$.a', max('...',json(y)))->>'$.a.b' FROM t1;
} {5}
# 2023-11-08 Forum post https://sqlite.org/forum/forumpost/68d284c86b082c3e
#
+3
View File
@@ -387,6 +387,9 @@ ifcapable attach {
PRAGMA integrity_check=4
}
} {{wrong # of entries in index i2} {row 1 missing from index i2} {row 2 missing from index i2} {wrong # of entries in index i2}}
do_catchsql_test pragma-3.5.2 {
PRAGMA integrity_check='4'
} {1 {no such table: 4}}
do_catchsql_test pragma-3.6 {
PRAGMA integrity_check=xyz
} {1 {no such table: xyz}}
+11
View File
@@ -520,4 +520,15 @@ do_execsql_test 20.3 {
8 N N N
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 21.0 {
PRAGMA writable_schema=ON;
INSERT INTO sqlite_schema DEFAULT VALUES RETURNING sqlite_schema.name;
} {{}}
do_execsql_test 21.1 {
INSERT INTO sqlite_temp_schema DEFAULT VALUES RETURNING sqlite_temp_schema.name;
} {{}}
finish_test
+26
View File
@@ -322,6 +322,32 @@ ifcapable altertable {
} {1 {table pragma_compile_options may not be altered}}
}
#-----------------------------------------------------------------------------
# 2024-04-26 LIMIT and OFFSET passed into virtual tables
# https://sqlite.org/forum/forumpost/c243b8f856
#
do_execsql_test tabfunc01-900 {
SELECT * FROM (
SELECT * FROM generate_series(1,10)
UNION ALL
SELECT * FROM generate_series(101,104)
) LIMIT 10 OFFSET 5;
} {6 7 8 9 10 101 102 103 104}
do_execsql_test tabfunc01-910 {
SELECT * FROM (
SELECT * FROM generate_series(1,10)
UNION ALL
SELECT * FROM generate_series(101,104)
) LIMIT -1 OFFSET 5;
} {6 7 8 9 10 101 102 103 104}
do_execsql_test tabfunc01-920 {
SELECT * FROM (
SELECT * FROM generate_series(1,10)
UNION ALL
SELECT * FROM generate_series(101,104)
) LIMIT -1 OFFSET 0;
} {1 2 3 4 5 6 7 8 9 10 101 102 103 104}
# Free up memory allocations
intarray_addr