diff options
Diffstat (limited to 'src/where.c')
-rw-r--r-- | src/where.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c index cfee45f87..448fe27c1 100644 --- a/src/where.c +++ b/src/where.c @@ -5811,13 +5811,16 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( } if( sqlite3ExprIsConstant(pExpr) ) continue; if( pExpr->op==TK_FUNCTION ){ + /* 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( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_SUBTYPE)!=0 ){ + if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){ continue; } } |