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   <[EMAIL PROTECTED]>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.

Attachment: signature.asc
Description: Digital signature

Reply via email to