Re: UUID datatype GiST index support

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Misa Simic <misa(dot)simic(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: UUID datatype GiST index support
Date: 2011-08-22 12:05:47
Message-ID: CAPpHfduv+n_WBxopz8_=kSapxjWZAd7U7LqHGv-6fHB6ioCBPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

On Mon, Aug 22, 2011 at 2:54 PM, Misa Simic <misa(dot)simic(at)gmail(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Misa Simic 2011-08-22 12:52:53 Re: UUID datatype GiST index support
Previous Message Misa Simic 2011-08-22 10:54:52 UUID datatype GiST index support