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