Fix planner to restore its previous level of intelligence about pushing
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:28 +0000 (20:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:28 +0000 (20:42 +0000)
commit4656b9df3db90cedb7da818e1531acea9e89a8c4
tree71b2ac99abb83a2f173783aa1302f2c07680835d
parentb25c9ba4dfca282beff535dff7b69202fa6e5f57
Fix planner to restore its previous level of intelligence about pushing
constants through full joins, as in

select * from tenk1 a full join tenk1 b using (unique1)
where unique1 = 42;

which should generate a fairly cheap plan where we apply the constraint
unique1 = 42 in each relation scan.  This had been broken by my patch of
2008-06-27, which is now reverted in favor of a more invasive but hopefully
less incorrect approach.  That patch was meant to prevent incorrect extraction
of OR'd indexclauses from OR conditions above an outer join.  To do that
correctly we need more information than the outerjoin_delay flag can provide,
so add a nullable_relids field to RestrictInfo that records exactly which
relations are nulled by outer joins that are underneath a particular qual
clause.  A side benefit is that we can make the test in create_or_index_quals
more specific: it is now smart enough to extract an OR'd indexclause into the
outer side of an outer join, even though it must not do so in the inner side.
The old coding couldn't distinguish these cases so it could not do either.
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/util/restrictinfo.c
src/include/nodes/relation.h
src/include/optimizer/restrictinfo.h