Richard Welty <rwelty@averillpark.net> writes:
> On Tue, 05 Aug 2003 15:09:00 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I don't think we have a suitable index type at the moment; or more
>> accurately, we don't have a suitable operator class. It would be an
>> interesting exercise to write an inet opclass for either rtree or GiST.
> hmmm. where should i go looking for sample code implementing operator
> classes as an example?
contrib. Specifically, I'd suggest looking at contrib/seg, which
defines a datatype for "interval on the real line" and builds a GIST
opclass for it. This seems like it'd map very easily to CIDR subnets.
There is a lot of cruft in contrib/seg that you don't need (at least
some coming from the fact that it originally was an rtree opclass not
a GiST opclass --- in GiST you can make your own choices about what
set of operators need to be supported, but seg just slavishly follows
the rtree design). But it's a working example...
I'd also suggest trying to get Oleg and Teodor involved, as they are the
only active hackers who have done anything much with GiST.
regards, tom lane