aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-07-28 02:53:36 +0000
committerdrh <drh@noemail.net>2010-07-28 02:53:36 +0000
commitcf4d38aaf0d7d1024e1b308c07b4934006666c3b (patch)
tree4c313dd1fb9d7a46ca42dd176a81e938e1400be9 /src/expr.c
parentd7ceb372aa9afa37012d15eeb0290ec5c1a1261c (diff)
downloadsqlite-cf4d38aaf0d7d1024e1b308c07b4934006666c3b.tar.gz
sqlite-cf4d38aaf0d7d1024e1b308c07b4934006666c3b.zip
Do not allow automatic indices for the RHS of IN expressions which are not
correlated subqueries. Ticket [8011086c85c6c404014c9] FossilOrigin-Name: 267492d3a7eff7b7b24ed6bd6d6ff55148fe37f3
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c
index bd28bf939..153751f7c 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1512,14 +1512,20 @@ int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
/* Could not found an existing table or index to use as the RHS b-tree.
** We will have to generate an ephemeral table to do the job.
*/
+ double savedNQueryLoop = pParse->nQueryLoop;
int rMayHaveNull = 0;
eType = IN_INDEX_EPH;
if( prNotFound ){
*prNotFound = rMayHaveNull = ++pParse->nMem;
- }else if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){
- eType = IN_INDEX_ROWID;
+ }else{
+ testcase( pParse->nQueryLoop>(double)1 );
+ pParse->nQueryLoop = (double)1;
+ if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){
+ eType = IN_INDEX_ROWID;
+ }
}
sqlite3CodeSubselect(pParse, pX, rMayHaveNull, eType==IN_INDEX_ROWID);
+ pParse->nQueryLoop = savedNQueryLoop;
}else{
pX->iTable = iTab;
}