aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-03-20 17:03:30 +0000
committerdrh <drh@noemail.net>2014-03-20 17:03:30 +0000
commitfbb24d1092c1c09a9493d382589176c1ba54bd52 (patch)
treed736a53d950951bd73f29d750efd0c6e078f8f7f /src/expr.c
parent4ef7efad5eccd9acc32c3ecce05026914beaa903 (diff)
downloadsqlite-fbb24d1092c1c09a9493d382589176c1ba54bd52.tar.gz
sqlite-fbb24d1092c1c09a9493d382589176c1ba54bd52.zip
The "x IN (?)" optimization in check-ins [2ff3b25f40] and [e68b427afb] is
incorrect, as demonstrated by the in4-5.1 test case in this check-in. The "COLLATE binary" that was being added to the RHS of IN was overriding the implicit collating sequence of the LHS. This change defines the EP_Generic expression node property that blocks all affinity or collating sequence information in the expression subtree and adds that property to the expression taken from RHS of the IN operator. FossilOrigin-Name: 2ea4a9f75f46eaa928ba17e9e91bc0432750d46d
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 83b948e8e..204d69617 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -33,6 +33,7 @@
char sqlite3ExprAffinity(Expr *pExpr){
int op;
pExpr = sqlite3ExprSkipCollate(pExpr);
+ if( pExpr->flags & EP_Generic ) return SQLITE_AFF_NONE;
op = pExpr->op;
if( op==TK_SELECT ){
assert( pExpr->flags&EP_xIsSelect );
@@ -122,6 +123,7 @@ CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
Expr *p = pExpr;
while( p ){
int op = p->op;
+ if( p->flags & EP_Generic ) break;
if( op==TK_CAST || op==TK_UPLUS ){
p = p->pLeft;
continue;