mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix problems with joining UNION ALL sub-queries against other sub-queries that contain LEFT JOIN.
FossilOrigin-Name: d554f710a5abbe64022f47a14ef67227c861a8f0991d85d240434e9a709cf8b8
This commit is contained in:
@@ -347,7 +347,7 @@ static void addWhereTerm(
|
||||
ExprSetProperty(pEq, EP_FromJoin);
|
||||
assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
|
||||
ExprSetVVAProperty(pEq, EP_NoReduce);
|
||||
pEq->iRightJoinTable = (i16)pE2->iTable;
|
||||
pEq->iRightJoinTable = pE2->iTable;
|
||||
}
|
||||
*ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ void sqlite3SetJoinExpr(Expr *p, int iTable){
|
||||
ExprSetProperty(p, EP_FromJoin);
|
||||
assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );
|
||||
ExprSetVVAProperty(p, EP_NoReduce);
|
||||
p->iRightJoinTable = (i16)iTable;
|
||||
p->iRightJoinTable = iTable;
|
||||
if( p->op==TK_FUNCTION && p->x.pList ){
|
||||
int i;
|
||||
for(i=0; i<p->x.pList->nExpr; i++){
|
||||
@@ -3691,6 +3691,9 @@ static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
|
||||
if( pExpr->op==TK_COLUMN && aCsrMap[pExpr->iTable] ){
|
||||
pExpr->iTable = aCsrMap[pExpr->iTable];
|
||||
}
|
||||
if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){
|
||||
pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable];
|
||||
}
|
||||
return WRC_Continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user