diff options
author | drh <drh@noemail.net> | 2016-08-26 13:19:49 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-08-26 13:19:49 +0000 |
commit | 0dfa4f6fcc8b442797dccda5c3409fec20c91b87 (patch) | |
tree | b7081f1a09f66a19141c49f303cb8287551f4f6c /src/expr.c | |
parent | 64bcb8cfbb6898d4554de7d88c1ed42dca2c2709 (diff) | |
download | sqlite-0dfa4f6fcc8b442797dccda5c3409fec20c91b87.tar.gz sqlite-0dfa4f6fcc8b442797dccda5c3409fec20c91b87.zip |
Allow ROWID values in indexed vector comparisons.
FossilOrigin-Name: b0cc6be4eb81f21b11796e1f14d4412bf21dea6e
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/expr.c b/src/expr.c index f0670799e..a62538c55 100644 --- a/src/expr.c +++ b/src/expr.c @@ -18,6 +18,13 @@ static void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int); static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree); +/* +** Return the affinity character for a single column of a table. +*/ +char sqlite3TableColumnAffinity(Table *pTab, int iCol){ + assert( iCol<pTab->nCol ); + return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER; +} /* ** Return the 'affinity' of the expression pExpr if any. @@ -52,11 +59,7 @@ char sqlite3ExprAffinity(Expr *pExpr){ } #endif if( op==TK_AGG_COLUMN || op==TK_COLUMN ){ - int j = pExpr->iColumn; - assert( pExpr->pTab!=0 ); - if( j<0 ) return SQLITE_AFF_INTEGER; - assert( pExpr->pTab && j<pExpr->pTab->nCol ); - return pExpr->pTab->aCol[j].affinity; + return sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn); } return pExpr->affinity; } @@ -2173,7 +2176,7 @@ int sqlite3FindInIndex( for(i=0; i<nExpr && affinity_ok; i++){ Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i); int iCol = pEList->a[i].pExpr->iColumn; - char idxaff = pTab->aCol[iCol].affinity; /* RHS table affinity */ + char idxaff = sqlite3TableColumnAffinity(pTab,iCol); /* RHS table */ char cmpaff = sqlite3CompareAffinity(pLhs, idxaff); testcase( cmpaff==SQLITE_AFF_BLOB ); testcase( cmpaff==SQLITE_AFF_TEXT ); @@ -2208,7 +2211,6 @@ int sqlite3FindInIndex( CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); int j; - assert( pReq || pParse->nErr ); if( pReq==0 ) break; for(j=0; j<nExpr; j++){ |