diff options
author | drh <drh@noemail.net> | 2013-08-01 15:09:57 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-08-01 15:09:57 +0000 |
commit | 66518ca71f739cc2830b18ffd57b888b284df4b3 (patch) | |
tree | c8e3d781108e546c50a54eb83455d11ec721f2fe /src/expr.c | |
parent | 619a1305e77cc6382013fb1e9c406d8fb88ca600 (diff) | |
download | sqlite-66518ca71f739cc2830b18ffd57b888b284df4b3.tar.gz sqlite-66518ca71f739cc2830b18ffd57b888b284df4b3.zip |
More test cases and corresponding bug fixes.
FossilOrigin-Name: 0c8cfdfae215c95cf167f404a1d346690b28e972
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 6fa34443a..8d6b90dd2 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3801,6 +3801,9 @@ void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ ** If any subelement of pB has Expr.iTable==(-1) then it is allowed ** to compare equal to an equivalent element in pA with Expr.iTable==iTab. ** +** The pA side might be using TK_REGISTER. If that is the case and pB is +** not using TK_REGISTER but is otherwise equivalent, then still return 0. +** ** Sometimes this routine will return 2 even if the two expressions ** really are equivalent. If we cannot prove that the expressions are ** identical, we return 2 just to be safe. So if this routine @@ -3821,7 +3824,7 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){ return 2; } if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; - if( pA->op!=pB->op ){ + if( pA->op!=pB->op && (pA->op!=TK_REGISTER || pA->op2!=pB->op) ){ if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){ return 1; } @@ -3834,7 +3837,9 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){ if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2; if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; if( pA->iColumn!=pB->iColumn ) return 2; - if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || pB->iTable>=0) ) return 2; + if( pA->iTable!=pB->iTable + && pA->op!=TK_REGISTER + && (pA->iTable!=iTab || pB->iTable>=0) ) return 2; if( ExprHasProperty(pA, EP_IntValue) ){ if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){ return 2; |