Fix a conceptual error in my patch of 2007-10-26 that avoided considering
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 11 Jan 2008 04:02:26 +0000 (04:02 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 11 Jan 2008 04:02:26 +0000 (04:02 +0000)
commitbcabf2195b8903c95cca187e44bd073de0e2f288
tree4e1988015fcd1efd90ddd12ee5b4579bcae3f705
parent02b3f326b2fde426ece942c54b6b8976184f4c79
Fix a conceptual error in my patch of 2007-10-26 that avoided considering
clauseless joins of relations that have unexploited join clauses.  Rather
than looking at every other base relation in the query, the correct thing is
to examine the other relations in the "initial_rels" list of the current
make_rel_from_joinlist() invocation, because those are what we actually have
the ability to join against.  This might be a subset of the whole query in
cases where join_collapse_limit or from_collapse_limit or full joins have
prevented merging the whole query into a single join problem.  This is a bit
untidy because we have to pass those rels down through a new PlannerInfo
field, but it's necessary.  Per bug #3865 from Oleg Kharin.
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/plan/planmain.c
src/include/nodes/relation.h