aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expr.c11
-rw-r--r--src/sqliteInt.h1
-rw-r--r--src/where.c3
-rw-r--r--src/whereexpr.c2
4 files changed, 15 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index ff4f1b5ad..6a1a9288a 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -4681,6 +4681,17 @@ int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
}
/*
+** Like sqlite3ExprCompare() except COLLATE operators at the top-level
+** are ignored.
+*/
+int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
+ return sqlite3ExprCompare(
+ sqlite3ExprSkipCollate(pA),
+ sqlite3ExprSkipCollate(pB),
+ iTab);
+}
+
+/*
** Return true if we can prove the pE2 will always be true if pE1 is
** true. Return false if we cannot complete the proof or if pE2 might
** be false. Examples:
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index f9768895a..23b4dd946 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3762,6 +3762,7 @@ void sqlite3Vacuum(Parse*,Token*);
int sqlite3RunVacuum(char**, sqlite3*, int);
char *sqlite3NameFromToken(sqlite3*, Token*);
int sqlite3ExprCompare(Expr*, Expr*, int);
+int sqlite3ExprCompareSkip(Expr*, Expr*, int);
int sqlite3ExprListCompare(ExprList*, ExprList*, int);
int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
diff --git a/src/where.c b/src/where.c
index 80dfa20ed..4c533aa49 100644
--- a/src/where.c
+++ b/src/where.c
@@ -209,7 +209,8 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
if( pTerm->leftCursor==iCur
&& pTerm->u.leftColumn==iColumn
&& (iColumn!=XN_EXPR
- || sqlite3ExprCompare(pTerm->pExpr->pLeft,pScan->pIdxExpr,iCur)==0)
+ || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
+ pScan->pIdxExpr,iCur)==0)
&& (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
){
if( (pTerm->eOperator & WO_EQUIV)!=0
diff --git a/src/whereexpr.c b/src/whereexpr.c
index f511452e5..248b5349d 100644
--- a/src/whereexpr.c
+++ b/src/whereexpr.c
@@ -874,7 +874,7 @@ static int exprMightBeIndexed(
if( pIdx->aColExpr==0 ) continue;
for(i=0; i<pIdx->nKeyCol; i++){
if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
- if( sqlite3ExprCompare(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
+ if( sqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
*piCur = iCur;
*piColumn = XN_EXPR;
return 1;