Dean Rasheed <dean.a.rasheed@gmail.com> writes:
>> 2011/6/28 Renat <renat.nasyrov@itv.ru>:
>>> select * from foo where date_to is null and date_to > '2011-01-01'
>>> Expected: 0 rows
>>> But: it return 1 row with id=2
> The problem seems to be in _bt_preprocess_keys(), which discards the
> "a > 10000" predicate in favour of the "a is null" predicate on the
> grounds that "null > 10000" in a nulls-last index.
> It looks like a previous revision had the right check, based on the
> logic that x IS NULL is incompatible with any other predicate.
Yeah, seems to be my fault :-(. Will fix.
regards, tom lane