GiST Comparing IndexTuples/Datums

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

Hey folks:

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-novice by date

  From Date Subject
Next Message Tom Lane 2007-02-12 06:33:07 Re: GiST Comparing IndexTuples/Datums
Previous Message Michael Fuhr 2007-02-12 04:25:06 Re: Problem adding columns