aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2017-06-28 15:56:58 +0000
committerdrh <drh@noemail.net>2017-06-28 15:56:58 +0000
commitd0bbe4e9c25fa8b942ebd514b06904f1cf1d8eb4 (patch)
tree0fc3ef9695f5e08c9fb3232a89337cba4ed3048c /src/select.c
parente9acf4b48eb1723721bd7693f6f04ec4d19bb3db (diff)
parent2fb960b545dd7bbdf101d8aced41d1448aa7477e (diff)
downloadsqlite-d0bbe4e9c25fa8b942ebd514b06904f1cf1d8eb4.tar.gz
sqlite-d0bbe4e9c25fa8b942ebd514b06904f1cf1d8eb4.zip
Incorporate recent trunk changes.
FossilOrigin-Name: 62b8269ba2ff71e2daaa86688698896badd6f6e34ab42fbf92dda7fcda73a230
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/select.c b/src/select.c
index 51cd089a2..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.
@@ -5290,6 +5293,8 @@ int sqlite3Select(
if( pPrior ){
sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
explainSetInteger(pItem->iSelectId, pPrior->iSelectId);
+ assert( pPrior->pSelect!=0 );
+ pSub->nSelectRow = pPrior->pSelect->nSelectRow;
}else{
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);