pgsql: Simplify overcomplicated (and overly restrictive) test to see

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Simplify overcomplicated (and overly restrictive) test to see
Date: 2009-02-20 00:01:03
Message-ID: 20090220000103.8604A7559ED@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Simplify overcomplicated (and overly restrictive) test to see whether an
IS NULL condition is rendered redundant by detection of an antijoin.
If we know that a join is an antijoin, then *any* Var coming out of its
righthand side must be NULL, not only the joining column(s). Also,
it's still gonna be null after being passed up through higher joins,
whether they're outer joins or not. I was misled by a faulty analogy
to reduce_outer_joins() in the original coding. But consider

select * from a left join b on a.x = b.y where b.y is null and b.z is null;

The first IS NULL condition justifies deciding that the join is an antijoin
(if the = is strict) and then the second one is just plain redundant.

Modified Files:
--------------
pgsql/src/backend/optimizer/plan:
initsplan.c (r1.146 -> r1.147)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.146&r2=1.147)

Browse pgsql-committers by date

  From Date Subject
Next Message User Fxjr 2009-02-20 02:12:34 npgsql - Npgsql2: Added tests for [#1010543] Parameter value
Previous Message Tom Lane 2009-02-19 20:39:56 Re: Re: [COMMITTERS] pgsql: Start background writer during archive recovery.