aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2022-05-12 11:56:44 +0000
committerdrh <>2022-05-12 11:56:44 +0000
commitd631c6af80fa779c504a53d29666540fc87bea93 (patch)
treef4c0f2c43f067a038752820760122e445e09ccf8 /src
parent902e2602c2792cbb3b4101f8cde3e0de610d2186 (diff)
downloadsqlite-d631c6af80fa779c504a53d29666540fc87bea93.tar.gz
sqlite-d631c6af80fa779c504a53d29666540fc87bea93.zip
Ensure that ON clauses are applied to the correct outer join.
FossilOrigin-Name: c7e3a13a3288c577209be99c630fbe924e19880e8af1aa8a83b517acaa8b43d7
Diffstat (limited to 'src')
-rw-r--r--src/wherecode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index a942e6e7f..979944e2e 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -2621,7 +2621,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
pE = pTerm->pExpr;
assert( pE!=0 );
if( (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ))
- && !ExprHasProperty(pE,EP_FromJoin|EP_InnerJoin)
+ && (!ExprHasProperty(pE,EP_FromJoin|EP_InnerJoin)
+ || pE->w.iJoin!=pTabItem->iCursor)
){
continue;
}