postgres.git / summary / log / commit / refs
commit 3f36070d72a54b94096e6853b185eb677a658369
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue Nov 02 22:45:44 2010 +0000
First released in: 9.1.0, 8.4.6, 9.0.2
Fix adjust_semi_join to be more cautious about clauseless joins.
It was reporting that these were fully indexed (hence cheap), when of
course they're the exact opposite of that. I'm not certain if the case
would arise in practice, since a clauseless semijoin is hard to produce
in SQL, but if it did happen we'd make some dumb decisions.
src/backend/optimizer/path/costsize.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 6f16eb81dcd..b27c26154cc 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -2810,12 +2810,20 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo,
*/
if (indexed_join_quals)
{
- List *nrclauses;
+ if (path->joinrestrictinfo != NIL)
+ {
+ List *nrclauses;
- nrclauses = select_nonredundant_join_clauses(root,
- path->joinrestrictinfo,
- path->innerjoinpath);
- *indexed_join_quals = (nrclauses == NIL);
+ nrclauses = select_nonredundant_join_clauses(root,
+ path->joinrestrictinfo,
+ path->innerjoinpath);
+ *indexed_join_quals = (nrclauses == NIL);
+ }
+ else
+ {
+ /* a clauseless join does NOT qualify */
+ *indexed_join_quals = false;
+ }
}
return true;
[parent: 368e44f6a54a]