Ryan VanMiddlesworth <ryan@vanmiddlesworth.org> writes:
> And here is the query and EXPLAIN from the version that I believe the planner
> should reduce to be logically equivalent:
> SELECT case_id FROM case_data
> WHERE (('2004-09-16' IS NULL) OR (case_filed_date > '2004-09-16'))
> AND (('2004-09-20' IS NULL) OR (case_filed_date < '2004-09-20'))
> I was hoping that the null comparisons would get folded out by the planner
> relatively cheaply.
You could teach eval_const_expressions about simplifying NullTest nodes
if you think it's important enough.
regards, tom lane