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.
This commit is contained in:
Tom Lane 2010-11-02 18:45:36 -04:00
parent 71baff1786
commit 61d6dd0c03
1 changed files with 13 additions and 5 deletions

View File

@ -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;