On Wed, Jul 05, 2006 at 12:00:05PM -0400, Greg Stark wrote:
> I'm a bit confused about how scan keys work. Is there any simple way given a
> list of Datums of the same type as the index tuple attributes to get all
> matching index entries? This is for a non-system index.

A scankey determines which values you want. It consists of a value and
an operator. Using that the index code returns tuples matching.

So if you want all values equal to 4, you pass '4' for the Datum and
the Equal strategy, with the operator as '='.

The info you need is in the operator class. In a sense you do need to
know the type of index you're scanning, not all indexes use the same
strategy numbers.

> But I want to do something more like what btree does inside btinsert where it
> knows that no cross-type functions could be necessary and the only function of
> interest is equality.

By the time the btree code gets involved, everything in the scankey
should already have been filled in.  I don't beleive the code actually
checks if the operator is of the type you specify.

Hope this helps a bit,
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.

Attachment: signature.asc
Description: Digital signature

Reply via email to