aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2017-06-20 17:43:26 +0000
committerdan <dan@noemail.net>2017-06-20 17:43:26 +0000
commitbd11a2acbb29dd6548dc49961d78694c5e0c3f7e (patch)
tree7b3239dc8c7d01d8da310dfddb6220256914c985 /src
parent40db2fd7a3018eae064e2b250ba78b23bfa6c3d8 (diff)
downloadsqlite-bd11a2acbb29dd6548dc49961d78694c5e0c3f7e.tar.gz
sqlite-bd11a2acbb29dd6548dc49961d78694c5e0c3f7e.zip
Ensure that the query planner knows that any column of a flattened LEFT JOIN
can be NULL even if that column is labeled with "NOT NULL". Fix for ticket [892fc34f173e99d8]. FossilOrigin-Name: 483462682d3a57fb9dd85b4772596e9738f1694a454b8ebbc480b9452733e88d
Diffstat (limited to 'src')
-rw-r--r--src/select.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/select.c b/src/select.c
index 6c99776e1..74747fadc 100644
--- a/src/select.c
+++ b/src/select.c
@@ -3205,9 +3205,12 @@ static Expr *substExpr(
pCopy = &ifNullRow;
}
pNew = sqlite3ExprDup(db, pCopy, 0);
- if( pNew && (pExpr->flags & EP_FromJoin) ){
+ if( pNew && pSubst->isLeftJoin ){
+ ExprSetProperty(pNew, EP_CanBeNull);
+ }
+ if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
pNew->iRightJoinTable = pExpr->iRightJoinTable;
- pNew->flags |= EP_FromJoin;
+ ExprSetProperty(pNew, EP_FromJoin);
}
sqlite3ExprDelete(db, pExpr);
pExpr = pNew;
@@ -3500,7 +3503,7 @@ static int flattenSubquery(
**
** If the subquery is the right operand of a LEFT JOIN, then the outer
** query cannot be an aggregate. This is an artifact of the way aggregates
- ** are processed - there is not mechanism to determine if the LEFT JOIN
+ ** are processed - there is no mechanism to determine if the LEFT JOIN
** table should be all-NULL.
**
** See also tickets #306, #350, and #3300.