Hello everybody,
I am quite a novice in using the extension features of the PostgreSQL database.
Actually, I have to do this for work at the university. At the moment, I am
trying around a little bit with creating my own types using shared objects,
written in C. The usage of static types with fi
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 t
Actually, I thought, I did this using the int32 variable called "dimension"
which should be exactly this field. Unfortunately, it seems, that something is
wrong here. I'll look inside the code of cube to determine the things I'm doing
wrong, currently. Thanks so far for your advice.
My in-method
Carsten Kropf wrote:
Actually, I thought, I did this using the int32 variable called
"dimension" which should be exactly this field.
yes.
in = (PointND *) palloc(sizeof(float8) * dimensions + VARHDRSZ);
SET_VARSIZE(in, dimensions);
What about
len = sizeof(float8) * dimensions + VARHDRSZ;
in =
Oh, I see, does the VARSIZE length field have to be the total number of bytes
occupied (including VARHDRSZ and the size of the structure) or only the size
that is used by "my" datatype? Then it would become pretty much obvious, why
this is not supposed to work.
I'll try it out then.
regards
Carsten Kropf wrote:
Oh, I see, does the VARSIZE length field have to be the total number of bytes occupied
(including VARHDRSZ and the size of the structure) or only the size that is used by
"my" datatype?
Yes
Then it would become pretty much obvious, why this is not supposed to work.
I'll
Thanks for the hint according to the cube, this was actually exactly what I
have been looking for. I wanted to do something similar like the cube but I
didn't think that it would be implemented in multiple dimension. I just
thought, the cube were a 3-d construct, but as I see in the sources, it
Thanks a lot so far. I adopted my structures and am now storing two fields
(v_len_ and dimensions) and the storage is now working properly. If I now would
try to combine two of these points to a range (like cube) including an upper
and a lower bound n-dimensional point structure, I don't get the
Carsten Kropf writes:
> Thanks a lot so far. I adopted my structures and am now storing two fields
> (v_len_ and dimensions) and the storage is now working properly. If I now
> would try to combine two of these points to a range (like cube) including an
> upper and a lower bound n-dimensional p
Thanks for this hint, I already got it to work in the meantime.
My approach now (based on the fact, that PointND is indeed a variable length
type) is to have the following structure:
struct Range
{
int vl_len_;
struct PointND limits[1];
};
whereas now vl_len_ stores the total size
10 matches
Mail list logo