Re: GiST consistent function, expected arguments; multi-dimensional indexes

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Eric <fishware(at)comcast(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: GiST consistent function, expected arguments; multi-dimensional indexes
Date: 2007-07-02 10:55:20
Message-ID: 20070702105520.GB12254@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 01, 2007 at 07:20:08PM -0700, Eric wrote:
>
> >
> > Everything is always passed as a Datum, so yes, it's is determined by
> > the storage clause in CREATE TYPE.
>
> Still not sure what to do in some scenarios. One example is the gist
> example code for btree (btree_gist). If you look at the int4 example
> consistent function, it gets an int32 value (param 1). For other
> data types, it would get a pointer to a value. Is the rule anything
> <= 4 bytes it's a value, above that it's a pointer? See the code
> below...

Why guess. You know the type ID of what you're manipulating, right.
Then the function:

get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);

Returns the byval flag (true if passed by value, false if passed by
reference) and the typlen field will be either a positive integer,
representing the number of bytes, or negative for variable length.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2007-07-02 10:59:46 ANALYZE and index/stats degradation
Previous Message Manera, Villiam 2007-07-02 09:50:28 R: R: [postgresql-it] no cascade triggers?