Re: Extending SQL in C using VARIABLE length type - Mailing list pgsql-general

From Yeb Havinga
Subject Re: Extending SQL in C using VARIABLE length type
Date
Msg-id 4B728CDC.4000505@gmail.com
Whole thread Raw
In response to Extending SQL in C using VARIABLE length type  (Carsten Kropf <ckropf2@fh-hof.de>)
Responses Re: Extending SQL in C using VARIABLE length type  (Carsten Kropf <ckropf2@fh-hof.de>)
List pgsql-general
Carsten Kropf wrote:
> The usage of static types with fixed length was actually no problem
> for me, so I proceeded to variable length types.
> I created an n-dimensional point structure called "PointND" that
> contains a field of float8 values of dynamic length. I also put in a
> int4/int32 field for the length specification, as required by the
> documentation. So the structure looks like the following:
> struct PointND
> {
> int32 dimensions;
> float8 coordinates[1];
> };
The structure should begin with a int32 vl_len_ header. At creation /
palloc time the size must be set with the SET_VARSIZE macro, and the
size can be queried with the VARSIZE_ * macros -> doxygen.postgresql.org
is your friend here. Take a look at e.g. contrib/cube for examples.

regards,
Yeb Havinga


pgsql-general by date:

Previous
From: Glyn Astill
Date:
Subject: Re: when a table was last vacuumed
Next
From: Carsten Kropf
Date:
Subject: Re: Extending SQL in C using VARIABLE length type