• Tom Lane's avatar
    Add some defenses against constant-FALSE outer join conditions. Since · 719012e0
    Tom Lane authored
    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.
    719012e0
joinrels.c 27.6 KB