Adjust join_search_one_level's handling of clauseless joins.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 1f0363001166ef6a43619846e44cfb9dbe7335ed
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-04-21T00:10:46Z
Releases: 9.2.0
Adjust join_search_one_level's handling of clauseless joins.

For an initial relation that lacks any join clauses (that is, it has to be
cartesian-product-joined to the rest of the query), we considered only
cartesian joins with initial rels appearing later in the initial-relations
list.  This creates an undesirable dependency on FROM-list order.  We would
never fail to find a plan, but perhaps we might not find the best available
plan.  Noted while discussing the logic with Amit Kapila.

Improve the comments a bit in this area, too.

Arguably this is a bug fix, but given the lack of complaints from the
field I'll refrain from back-patching.

Files

PathChange+/−
src/backend/optimizer/path/joinrels.c modified +27 −19