1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Fix a problem handling (a, b) IN (SELECT ...) expressions when there is an index on just one of "a" or "b".

FossilOrigin-Name: 231c72d9f651f3a70d5c8af080f3ff181b89d939
This commit is contained in:
dan
2016-09-06 14:58:15 +00:00
parent ed24da4b16
commit 83c434e68d
4 changed files with 50 additions and 11 deletions

View File

@ -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);