GiST Comparing IndexTuples/Datums

From: "Matthew Campbell" <mtthw(dot)cmpbll(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: GiST Comparing IndexTuples/Datums
Date: 2007-02-12 20:11:42
Message-ID: c2cc277f0702121211x3ae5409ax776b1c9e64d893ea@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey folks:

I posted this to the pgsql-novice mailing list but was told that it'd
probably be better to repost here. I've been working with a group trying to
implement UNIQUE index functionality in GiST (we started with hash, and have
branched out to try and understand some of the other indexing structures as
well). We installed the btree-gist contrib module and have gist indexes
working fine and understanding when it's supposed to be unique (regardless
of which contrib module is installed). We currently can walk over all the
IndexTuples in a page and we were hoping to compare the IndexTuple passed
into the gistdoinsert() function (the new itup being added to the index) to
each of the IndexTuples in said page. The idea we've been playing with
right now is using 'datum = index_getattr(itup, 1, RelationGetDescr(r),
&isnull);' as its used in hashinsert.c, but we can't figure out how to
compare the two datums then. The actual data type of the value being
inserted would be different depending on the type of column you created the
index on. Since you provide an opclass when creating a gist index, are we
supposed to use one of the user defined functions to compare items? (One of
them is 'same', so in btree-gist, the function is gbt_text_same() for
indexes on char and text columns) Is there a general way to access these
functions without knowing specifically what contrib module is specified,
something like OpClassFunction7()? Thanks so much for humoring me, and I
apologize as I get myself familiar with PostgreSQL and database concepts in
general.

-Matt

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-02-12 20:43:46 Safe outer-join orderings
Previous Message Lukas Kahwe Smith 2007-02-12 19:52:49 OT: IRC nick to real world mapping