aboutsummaryrefslogtreecommitdiff
path: root/src/wherecode.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-11-17 13:13:25 +0000
committerdrh <drh@noemail.net>2016-11-17 13:13:25 +0000
commit54cda4edbee1febc11e4c7ae0eb56ad5b2253a68 (patch)
treecb11078851bc0d3a7564e509909c31b240773d82 /src/wherecode.c
parentd2d69cc1fa930905ac2c15a20f7c34f909a61924 (diff)
downloadsqlite-54cda4edbee1febc11e4c7ae0eb56ad5b2253a68.tar.gz
sqlite-54cda4edbee1febc11e4c7ae0eb56ad5b2253a68.zip
Disable the query flattener optimization for SELECT statements that are on
the RHS of vector IN operators. This is a hack that fixes the bug described in ticket [da7841375186386c]. A better solution that does not disable the query flattener is needed, but this will server for the time being. FossilOrigin-Name: 005d5b870625d175fdf3c0e87d974006c569d9e1
Diffstat (limited to 'src/wherecode.c')
-rw-r--r--src/wherecode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index d547a7117..9a4961d29 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -446,6 +446,7 @@ static int codeEqualityTerm(
}else{
Select *pSelect = pX->x.pSelect;
sqlite3 *db = pParse->db;
+ u16 savedDbOptFlags = db->dbOptFlags;
ExprList *pOrigRhs = pSelect->pEList;
ExprList *pOrigLhs = pX->pLeft->x.pList;
ExprList *pRhs = 0; /* New Select.pEList for RHS */
@@ -489,7 +490,9 @@ static int codeEqualityTerm(
testcase( aiMap==0 );
}
pSelect->pEList = pRhs;
+ db->dbOptFlags |= SQLITE_QueryFlattener;
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap);
+ db->dbOptFlags = savedDbOptFlags;
testcase( aiMap!=0 && aiMap[0]!=0 );
pSelect->pEList = pOrigRhs;
pLeft->x.pList = pOrigLhs;