Fix planner to restore its previous level of intelligence about pushing
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:16 +0000 (20:42 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Apr 2009 20:42:16 +0000 (20:42 +0000)
commiteac315e23b1ae8f3107dac328e6000afde18179b
tree985b964167298506a09e1fc140157f2cecaf883a
parent3a2754a3dc1a9f14b961b4a456008a01a8947eee
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