mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Ensure the EXISTS->IN transformation preserves the collation sequence of the comparison operation.
FossilOrigin-Name: a373baae12c914e48fd84de77998e301fdd3da43b06b9d64ac24a14418ed48cd
This commit is contained in:
@@ -1175,12 +1175,18 @@ static void exprAnalyzeExists(
|
||||
pInLhs = exprAnalyzeExistsFindEq(pSel, &pEq, &ppAnd);
|
||||
assert( pInLhs && pEq );
|
||||
assert( pEq==pSel->pWhere || ppAnd );
|
||||
if( pInLhs==pEq->pLeft ){
|
||||
pRet = pEq->pRight;
|
||||
}else{
|
||||
CollSeq *p = sqlite3ExprCompareCollSeq(pParse, pEq);
|
||||
pInLhs = sqlite3ExprAddCollateString(pParse, pInLhs, p?p->zName:"BINARY");
|
||||
pRet = pEq->pLeft;
|
||||
}
|
||||
|
||||
assert( pDup->pLeft==0 );
|
||||
pDup->op = TK_IN;
|
||||
pDup->pLeft = pInLhs;
|
||||
pDup->flags &= ~EP_VarSelect;
|
||||
pRet = (pInLhs==pEq->pLeft) ? pEq->pRight : pEq->pLeft;
|
||||
pSel->pEList = sqlite3ExprListAppend(pParse, 0, pRet);
|
||||
pEq->pLeft = 0;
|
||||
pEq->pRight = 0;
|
||||
|
||||
Reference in New Issue
Block a user