aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-11-02 18:45:36 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2010-11-02 18:45:36 -0400
commit61d6dd0c03eb4da654f435097cd0bf1da11c3272 (patch)
tree5e81db71ef307484f356398ad6632b221b753f45
parent71baff1786e0c50b514745c64c4b0947b64bf9d0 (diff)
downloadpostgresql-61d6dd0c03eb4da654f435097cd0bf1da11c3272.tar.gz
postgresql-61d6dd0c03eb4da654f435097cd0bf1da11c3272.zip
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.
-rw-r--r--src/backend/optimizer/path/costsize.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 067cbca1254..16a5d0a3ca2 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -2897,12 +2897,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;