Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals
Date
Msg-id CAMbWs4_SVvKOeOj62Ty4z2jtFdnwN_0nsV6KA2F9arvh5rmyVA@mail.gmail.com
Whole thread Raw
In response to Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals  (Andy Fan <zhihuifan1213@163.com>)
Responses Re: Removing const-false IS NULL quals and redundant IS NOT NULL quals
List pgsql-hackers

On Wed, Dec 27, 2023 at 7:38 PM Andy Fan <zhihuifan1213@163.com> wrote:
I also want to add notnullattnums for the UniqueKey stuff as well, by
comparing your implementation with mine,  I found you didn't consider
the NOT NULL generated by filter. After apply your patch:

create table a(a int);
explain (costs off) select * from a where a > 3 and a is null;
             QUERY PLAN             
-------------------------------------
 Seq Scan on a
   Filter: ((a IS NULL) AND (a > 3))
(2 rows)

The detection of self-inconsistent restrictions already exists in
planner.

# set constraint_exclusion to on;
SET
# explain (costs off) select * from a where a > 3 and a is null;
        QUERY PLAN
--------------------------
 Result
   One-Time Filter: false
(2 rows)

Thanks
Richard

pgsql-hackers by date:

Previous
From: Andreas Seltenreich
Date:
Subject: Failed assertion in joininfo.c, remove_join_clause_from_rels
Next
From: Alexander Korotkov
Date:
Subject: Re: Failed assertion in joininfo.c, remove_join_clause_from_rels