aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2021-01-16 18:55:10 +0000
committerdrh <>2021-01-16 18:55:10 +0000
commit4be8bdccd453440e653f04bb6da4dcecf4bdfa68 (patch)
tree37bf1931464cf323e69ff076199e48f91a15a97b /src
parent2a3be742caf8c35330038ce839f9a735e847045e (diff)
downloadsqlite-4be8bdccd453440e653f04bb6da4dcecf4bdfa68.tar.gz
sqlite-4be8bdccd453440e653f04bb6da4dcecf4bdfa68.zip
Give the EXISTS-to-IN optimization the ability to handle some cases that
involve vector comparisons, instead of throwing a mysterious error in those cases. FossilOrigin-Name: 87e78a19bb3ae1caf57aeeae53a5ab4efdccb57265f25d5c19b62eae53747aff
Diffstat (limited to 'src')
-rw-r--r--src/whereexpr.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/whereexpr.c b/src/whereexpr.c
index 1772aa748..e3c02deac 100644
--- a/src/whereexpr.c
+++ b/src/whereexpr.c
@@ -1215,16 +1215,24 @@ static void exprAnalyzeExists(
if( pInLhs==pEq->pLeft ){
pRet = pEq->pRight;
}else{
- CollSeq *p = sqlite3ExprCompareCollSeq(pParse, pEq);
- pInLhs = sqlite3ExprAddCollateString(pParse, pInLhs, p?p->zName:"BINARY");
pRet = pEq->pLeft;
+ if( pRet->op!=TK_VECTOR ){
+ CollSeq *p = sqlite3ExprCompareCollSeq(pParse, pEq);
+ pInLhs = sqlite3ExprAddCollateString(pParse, pInLhs, p?p->zName:"BINARY");
+ }
}
assert( pDup->pLeft==0 );
pDup->op = TK_IN;
pDup->pLeft = pInLhs;
pDup->flags &= ~EP_VarSelect;
- pSel->pEList = sqlite3ExprListAppend(pParse, 0, pRet);
+ if( pRet->op==TK_VECTOR ){
+ pSel->pEList = pRet->x.pList;
+ pRet->x.pList = 0;
+ sqlite3ExprDelete(db, pRet);
+ }else{
+ pSel->pEList = sqlite3ExprListAppend(pParse, 0, pRet);
+ }
pEq->pLeft = 0;
pEq->pRight = 0;
if( ppAnd ){