diff options
author | dan <dan@noemail.net> | 2016-09-06 14:58:15 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-09-06 14:58:15 +0000 |
commit | 83c434e68d61531902d32a42d28a8a0d240c47f8 (patch) | |
tree | 13fc39b28432911a5206feecb7293ce7506613e2 /src/wherecode.c | |
parent | ed24da4b16fe235e0a5e9c41f92bfb45b5f3448e (diff) | |
download | sqlite-83c434e68d61531902d32a42d28a8a0d240c47f8.tar.gz sqlite-83c434e68d61531902d32a42d28a8a0d240c47f8.zip |
Fix a problem handling (a, b) IN (SELECT ...) expressions when there is an index on just one of "a" or "b".
FossilOrigin-Name: 231c72d9f651f3a70d5c8af080f3ff181b89d939
Diffstat (limited to 'src/wherecode.c')
-rw-r--r-- | src/wherecode.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wherecode.c b/src/wherecode.c index 896509bc3..2de1d3ca9 100644 --- a/src/wherecode.c +++ b/src/wherecode.c @@ -463,11 +463,20 @@ static int codeEqualityTerm( } } if( !db->mallocFailed ){ + Expr *pLeft = pX->pLeft; + /* Take care here not to generate a TK_VECTOR containing only a + ** single value. Since the parser never creates such a vector, some + ** of the subroutines do not handle this case. */ + if( pLhs->nExpr==1 ){ + pX->pLeft = pLhs->a[0].pExpr; + }else{ + pLeft->x.pList = pLhs; + } pX->x.pSelect->pEList = pRhs; - pX->pLeft->x.pList = pLhs; eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap); pX->x.pSelect->pEList = pOrigRhs; - pX->pLeft->x.pList = pOrigLhs; + pLeft->x.pList = pOrigLhs; + pX->pLeft = pLeft; } sqlite3ExprListDelete(pParse->db, pLhs); sqlite3ExprListDelete(pParse->db, pRhs); |