aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2025-05-29 18:44:41 +0000
committerdrh <>2025-05-29 18:44:41 +0000
commitf429845a601114c559593f98d087f47a567e7dc4 (patch)
tree03e4d9cbe23eb2a7a8afbedb1c027ade008a7474 /src
parentb163f66de0a153495970c952fdaafb0df05f739b (diff)
downloadsqlite-f429845a601114c559593f98d087f47a567e7dc4.tar.gz
sqlite-f429845a601114c559593f98d087f47a567e7dc4.zip
Extend the fix for ticket [623eff57e76d45f6] so that it covers RIGHT JOIN
in addition to LEFT JOIN. Problem reported by [forum:/forumpost/7dee41d32506c4ae|forum post 2025-05-29T15:10:14Z]. FossilOrigin-Name: 29b1e1b97619d03a97ef562a5707929e241d019179b4ff1d0bc2a8c008441431
Diffstat (limited to 'src')
-rw-r--r--src/wherecode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wherecode.c b/src/wherecode.c
index 95b12b77a..8e3e56cb1 100644
--- a/src/wherecode.c
+++ b/src/wherecode.c
@@ -2201,12 +2201,13 @@ Bitmask sqlite3WhereCodeOneLoopStart(
if( pLevel->iLeftJoin==0 ){
/* If a partial index is driving the loop, try to eliminate WHERE clause
** terms from the query that must be true due to the WHERE clause of
- ** the partial index.
+ ** the partial index. This optimization does not work on an outer join,
+ ** as shown by:
**
- ** 2019-11-02 ticket 623eff57e76d45f6: This optimization does not work
- ** for a LEFT JOIN.
+ ** 2019-11-02 ticket 623eff57e76d45f6 (LEFT JOIN)
+ ** 2025-05-29 forum post 7dee41d32506c4ae (RIGHT JOIN)
*/
- if( pIdx->pPartIdxWhere ){
+ if( pIdx->pPartIdxWhere && pLevel->pRJ==0 ){
whereApplyPartialIndexConstraints(pIdx->pPartIdxWhere, iCur, pWC);
}
}else{