diff options
author | dan <Dan Kennedy> | 2023-11-10 15:03:18 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2023-11-10 15:03:18 +0000 |
commit | 0eed27d38bdd23c596f46d24dd81be9af470dcd6 (patch) | |
tree | b3921a591489477619695feb52aa9604633638e3 /src/select.c | |
parent | 9d60c3c256feae4d48d833c4eafcb83d8da0c695 (diff) | |
download | sqlite-0eed27d38bdd23c596f46d24dd81be9af470dcd6.tar.gz sqlite-0eed27d38bdd23c596f46d24dd81be9af470dcd6.zip |
Fix an obscure problem with the join-strength-reduction optimization that could occur when mixing LEFT and RIGHT joins in the same query. [forum:/forumpost/7f74ce0bee|Forum post 7f74ce0bee].
FossilOrigin-Name: 530d10e93a5f63b71aaa94a2b89102d012a2cda815997066beb0f585fe823536
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/select.c b/src/select.c index 7a79385e0..c2685b370 100644 --- a/src/select.c +++ b/src/select.c @@ -7397,6 +7397,7 @@ int sqlite3Select( TREETRACE(0x1000,pParse,p, ("LEFT-JOIN simplifies to JOIN on term %d\n",i)); pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER); + unsetJoinExpr(p->pWhere, pItem->iCursor, 0); } } if( pItem->fg.jointype & JT_LTORJ ){ @@ -7411,6 +7412,7 @@ int sqlite3Select( TREETRACE(0x1000,pParse,p, ("RIGHT-JOIN simplifies to JOIN on term %d\n",j)); pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER); + unsetJoinExpr(p->pWhere, pI2->iCursor, 1); } } } @@ -7419,9 +7421,6 @@ int sqlite3Select( if( pTabList->a[j].fg.jointype & JT_RIGHT ) break; } } - assert( pItem->iCursor>=0 ); - unsetJoinExpr(p->pWhere, pItem->iCursor, - pTabList->a[0].fg.jointype & JT_LTORJ); } /* No further action if this term of the FROM clause is not a subquery */ |