diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/attach.c | 4 | ||||
-rw-r--r-- | src/btree.c | 2 | ||||
-rw-r--r-- | src/whereexpr.c | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/attach.c b/src/attach.c index 224d120b6..65b98a623 100644 --- a/src/attach.c +++ b/src/attach.c @@ -234,7 +234,9 @@ static void attachFunc( sqlite3BtreeEnterAll(db); db->init.iDb = 0; db->mDbFlags &= ~(DBFLAG_SchemaKnownOk); - rc = sqlite3Init(db, &zErrDyn); + if( !REOPEN_AS_MEMDB(db) ){ + rc = sqlite3Init(db, &zErrDyn); + } sqlite3BtreeLeaveAll(db); assert( zErrDyn==0 || rc!=SQLITE_OK ); } diff --git a/src/btree.c b/src/btree.c index d80f135f2..2b43d1f9d 100644 --- a/src/btree.c +++ b/src/btree.c @@ -1573,7 +1573,7 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){ } iAddr = pc; pc = get2byte(&aData[pc]); - if( pc<iAddr+size ){ + if( pc<=iAddr+size ){ if( pc ){ /* The next slot in the chain is not past the end of the current slot */ *pRc = SQLITE_CORRUPT_PAGE(pPg); diff --git a/src/whereexpr.c b/src/whereexpr.c index db0a38d62..961495c58 100644 --- a/src/whereexpr.c +++ b/src/whereexpr.c @@ -1520,6 +1520,12 @@ Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ }else if( p->x.pList ){ mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList); } +#ifndef SQLITE_OMIT_WINDOWFUNC + if( p->op==TK_FUNCTION && p->y.pWin ){ + mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pPartition); + mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy); + } +#endif return mask; } Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ |