Simon Riggs <simon@2ndquadrant.com> writes:
> Sweating over the logic of the theorem prover, I notice it doesn't
> actually bother to complete an accurate test.
Sure it does.
> create index idx1 on tenk (col1) where col1 > 1 and col1 < 10;
> explain select * from tenk where col1 > 5 and col1 < -5;
> [ uses that index ]
This is a perfectly legitimate situation. "col1 > 5" implies "col1 > 1"
and "col1 < -5" implies "col1 < 10", therefore the query WHERE condition
implies the index predicate, therefore the index contains all tuples
that could pass the WHERE condition, therefore the index is usable.
Kindly do not break this.
regards, tom lane