Re: UUID datatype GiST index support - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: UUID datatype GiST index support
Date
Msg-id CAPpHfduv+n_WBxopz8_=kSapxjWZAd7U7LqHGv-6fHB6ioCBPg@mail.gmail.com
Whole thread Raw
In response to UUID datatype GiST index support  (Misa Simic <misa.simic@gmail.com>)
Responses Re: UUID datatype GiST index support
List pgsql-hackers
Hi!

On Mon, Aug 22, 2011 at 2:54 PM, Misa Simic <misa.simic@gmail.com> wrote:
static int
m4_uuidkey_cmp(const void *a, const void *b)
{
uuidKEY    *ia = (uuidKEY *) (((Usrt *) a)->t);
uuidKEY    *ib = (uuidKEY *) (((Usrt *) b)->t);
int res;

res = DatumGetInt32(DirectFunctionCall2(uuid_cmp, UUIDPGetDatum(ia->upper), UUIDPGetDatum(ia->upper)));
if (res == 0)
return DatumGetInt32(DirectFunctionCall2(uuid_cmp, UUIDPGetDatum(ia->upper), UUIDPGetDatum(ib->upper)));

return res;
}


Getting error: aggregate error used where an integer was expected!
Seems that you need the address-of operator before ia->upper and ia->lower (likely one of operands should be "ia->lower"). UUIDPGetDatum except pointer as an argument, i.e. UUIDPGetDatum(&ia->upper).
 
It would be a lot appreciated if anyone could help me and suggest the best way to make Gist support for UUID datatype...
I think you're on the right way. btree_gist is an extension which provides GiST indexing of scalar datatype. UUID is one of them. So, the module you are writing should be quite similar.
 
------
With best regards,
Alexander Korotkov.

pgsql-hackers by date:

Previous
From: Misa Simic
Date:
Subject: UUID datatype GiST index support
Next
From: Misa Simic
Date:
Subject: Re: UUID datatype GiST index support