Explicit collations always override implicit collations. This is
backwards compatible since SQLite has not previously supported
explicit collations. Need to add tests of this new behavior. (CVS 3633)
FossilOrigin-Name: 3638823a629164e4158f76d03ff2cea1eab34e9d
diff --git a/src/expr.c b/src/expr.c
index 27bb7b8..ced48d8 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.274 2007/02/02 12:44:37 drh Exp $
+** $Id: expr.c,v 1.275 2007/02/07 13:09:46 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -176,9 +176,20 @@
** type.
*/
static CollSeq* binaryCompareCollSeq(Parse *pParse, Expr *pLeft, Expr *pRight){
- CollSeq *pColl = sqlite3ExprCollSeq(pParse, pLeft);
- if( !pColl ){
- pColl = sqlite3ExprCollSeq(pParse, pRight);
+ CollSeq *pColl;
+ assert( pLeft );
+ assert( pRight );
+ if( pLeft->flags & EP_ExpCollate ){
+ assert( pLeft->pColl );
+ pColl = pLeft->pColl;
+ }else if( pRight->flags & EP_ExpCollate ){
+ assert( pRight->pColl );
+ pColl = pRight->pColl;
+ }else{
+ pColl = sqlite3ExprCollSeq(pParse, pLeft);
+ if( !pColl ){
+ pColl = sqlite3ExprCollSeq(pParse, pRight);
+ }
}
return pColl;
}