On Wed, Dec 27, 2023 at 7:38 PM Andy Fan <[email protected]> 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