Add some defenses against constant-FALSE outer join conditions. Since
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Aug 2008 19:40:11 +0000 (19:40 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 17 Aug 2008 19:40:11 +0000 (19:40 +0000)
commitf0608cf98750b535b494d41331a69f889d564b25
tree47899b8fd6662709f1e2a7530ac480d79dac37ea
parent1fd289ade12adbf9ceab44d976bd56d8594a8427
Add some defenses against constant-FALSE outer join conditions.  Since
eval_const_expressions will generally throw away anything that's ANDed with
constant FALSE, what we're left with given an example like

select * from tenk1 a where (unique1,0) in (select unique2,1 from tenk1 b);

is a cartesian product computation, which is really not acceptable.
This is a regression in CVS HEAD compared to previous releases, which were
able to notice the impossible join condition in this case --- though not in
some related cases that are also improved by this patch, such as

select * from tenk1 a left join tenk1 b on (a.unique1=b.unique2 and 0=1);

Fix by skipping evaluation of the appropriate side of the outer join in
cases where it's demonstrably unnecessary.
src/backend/optimizer/path/joinrels.c