aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <>2023-05-15 02:06:35 +0000
committerdrh <>2023-05-15 02:06:35 +0000
commiteb4455e4e4db00014ece5dc6e3ae0216b8fae614 (patch)
tree8e31d73e5aed00ad3eb867b65abaf2698de4d1b8 /src/select.c
parentfa746af4a37b787251ee639a9f0e1891dca13802 (diff)
downloadsqlite-eb4455e4e4db00014ece5dc6e3ae0216b8fae614.tar.gz
sqlite-eb4455e4e4db00014ece5dc6e3ae0216b8fae614.zip
As evidenced by [forum:/forumpost/f3f546025a|forum post f3f546025a], the
new RIGHT JOIN related restriction on the push-down optimization implemented by [da3fba18742b6e0b] also needs to apply to the automatic index (a.k.a. hash-join) optimization and to the Bloom filter optimization. Computation of the restriction is now moved into the sqlite3ExprIsSingleTableConstraint() routine. FossilOrigin-Name: 4902015dcf3869f08d9986e422faa231d9218a5e0fc59ba8df0f407e4eb3d605
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/select.c b/src/select.c
index f2bf3f303..f32db2c2a 100644
--- a/src/select.c
+++ b/src/select.c
@@ -5119,7 +5119,8 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){
**
** Without this restriction, the push-down optimization might move
** the ON/USING filter expression from the left side of a RIGHT JOIN
-** over to the right side, which leads to incorrect answers.
+** over to the right side, which leads to incorrect answers. See
+** also restriction (6) in sqlite3ExprIsSingleTableConstraint().
**
** (10) The inner query is not the right-hand table of a RIGHT JOIN.
**
@@ -5204,6 +5205,7 @@ static int pushDownWhereTerms(
pWhere = pWhere->pLeft;
}
+#if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
if( ExprHasProperty(pWhere, EP_OuterON|EP_InnerON) /* (9a) */
&& (pSrcList->a[0].fg.jointype & JT_LTORJ)!=0 /* Fast pre-test of (9c) */
){
@@ -5221,8 +5223,6 @@ static int pushDownWhereTerms(
}
}
}
-
-#if 0 /* These checks now done by sqlite3ExprIsSingleTableConstraint() */
if( isLeftJoin
&& (ExprHasProperty(pWhere,EP_OuterON)==0
|| pWhere->w.iJoin!=iCursor)
@@ -5236,7 +5236,7 @@ static int pushDownWhereTerms(
}
#endif
- if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrc) ){
+ if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){
nChng++;
pSubq->selFlags |= SF_PushDown;
while( pSubq ){