| From: | Yeb Havinga <yebhavinga(at)gmail(dot)com> |
|---|---|
| To: | Carsten Kropf <ckropf2(at)fh-hof(dot)de> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Extending SQL in C using VARIABLE length type |
| Date: | 2010-02-10 10:39:24 |
| Message-ID: | 4B728CDC.4000505@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Carsten Kropf | 2010-02-10 10:51:36 | Re: Extending SQL in C using VARIABLE length type |
| Previous Message | MOLINA BRAVO FELIPE DE JESUS | 2010-02-10 10:33:17 | Re: xpath |