aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2017-05-25 17:27:52 +0000
committerdrh <drh@noemail.net>2017-05-25 17:27:52 +0000
commit137c46f8b6a0d1beb1dc3086b6e8962b0a3f6f1c (patch)
treeea962085ca7158cbfe07f8c4c2d3a7db06d4ed4c /src
parentf43ce0b4450965b62e24479db4f21b1917e6bc6d (diff)
parent65ff63ea6213639074d8b8fb415104500d6dc775 (diff)
downloadsqlite-137c46f8b6a0d1beb1dc3086b6e8962b0a3f6f1c.tar.gz
sqlite-137c46f8b6a0d1beb1dc3086b6e8962b0a3f6f1c.zip
Merge the LEFT JOIN query flattener fixes from 3.19.2.
FossilOrigin-Name: 6513e4a121e32df7e5cd95f47cdf8049b85bdbcb378cf23db29838fb1143d3ce
Diffstat (limited to 'src')
-rw-r--r--src/select.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c
index f620027a4..ff7d6c6e4 100644
--- a/src/select.c
+++ b/src/select.c
@@ -3511,6 +3511,14 @@ static int flattenSubquery(
return 0; /* Restriction (3) */
}
}
+#ifdef SQLITE_EXTRA_IFNULLROW
+ else if( iFrom>0 && !isAgg ){
+ /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for
+ ** every reference to any result column from subquery in a join, even though
+ ** they are not necessary. This will stress-test the OP_IfNullRow opcode. */
+ isLeftJoin = -1;
+ }
+#endif
/* Restriction 17: If the sub-query is a compound SELECT, then it must
** use only the UNION ALL operator. And none of the simple select queries
@@ -3764,7 +3772,7 @@ static int flattenSubquery(
pSub->pOrderBy = 0;
}
pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);
- if( isLeftJoin ){
+ if( isLeftJoin>0 ){
setJoinExpr(pWhere, iNewParent);
}
if( subqueryIsAgg ){