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




---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to