On Tue, 2005-06-21 at 16:29 -0400, Tom Lane wrote:
> > 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.
Like I said, its correct. I didn't suggest changing it.
> "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.
..."all tuples that pass the WHERE condition", like none.
Guess I'm not Mr Logic.
Best Regards, Simon Riggs