aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2017-05-25 11:39:50 +0000
committerdrh <drh@noemail.net>2017-05-25 11:39:50 +0000
commitdc6de47925e142e1b5bdd9960c9c20a7fc214a02 (patch)
tree3295fb990e94c081c2c7dca033b29e1bc514357f /src
parent074ce1e7fd7fc55186b5578d484fa5a3f39f8d3b (diff)
downloadsqlite-dc6de47925e142e1b5bdd9960c9c20a7fc214a02.tar.gz
sqlite-dc6de47925e142e1b5bdd9960c9c20a7fc214a02.zip
The SQLITE_EXTRA_IFNULLROW compile-time option causes OP_IfNullRow opcodes
to be issued for references to the right-hand side table of *any* flattened join, not just LEFT JOINs. This puts extra stress on the OP_IfNUllRow opcodes for testing purposes. FossilOrigin-Name: 1a074c8a2bc0b28918ef905339d11a21d30101b4ea8c06c8b3faca7d17237538
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 ){