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:18 +0000 (04:02 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 11 Jan 2008 04:02:18 +0000 (04:02 +0000)
commit59fc64acee20071dd7386408c2e22a28e8c86541
treead388473398ef7c2cae2d46a048bb9ce9d2355b7
parente6a442c71b30f62e7b5eee6058afc961b1c7f29b
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