From a3f4c8a0db1f9683b442b09e470b8693ac49dd03 Mon Sep 17 00:00:00 2001 From: "D. Richard Hipp" Date: Thu, 7 Dec 2017 22:10:16 +0000 Subject: [PATCH] When doing a table scan using an index, do not error out if collating functions used by that index are unavailable, since they will not be used. --- src/where.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/where.c b/src/where.c index 27979efbc4..e11194bdd4 100644 --- a/src/where.c +++ b/src/where.c @@ -4870,7 +4870,16 @@ WhereInfo *sqlite3WhereBegin( assert( iIndexCur>=0 ); if( op ){ sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb); + + /* If the index is only being scanned - if there is no searching - + ** then no collating functions are required. Set db->init.busy in that + ** case, to prevent sqlite3VdbeSetP4KeyInfo() from raising needless + ** errors about the missing collating functions. */ + assert( db->init.busy==0 ); + db->init.busy = (pLoop->wsFlags & ~(WHERE_IDX_ONLY|WHERE_INDEXED))==0; sqlite3VdbeSetP4KeyInfo(pParse, pIx); + db->init.busy = 0; /* Restore db->init.busy */ + if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0 && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0 && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 -- 2.11.4.GIT