Hi,
I am trying to create complex user-defined base types and have some difficulties.
I started with the examples (complex, point, path) and I had no problem at all
creating similar user-defined types, with fixed or variable length. They
perform very good in all my tests (inserts, selects and so on).
The problem I have is I need more elaborate types, types containing other previously defined types. I try for example to create and use something like:
typedef struct SymbolType { int32 size; bool antialias; char character; bool filled; text *font; int32 gap; text *image; text *name; PathType *points; SymbolStyleType *style; int32 transparent; int32 type; } SymbolType;
where PathType and SymbolStyleType are also user-defined type with variable
length (PathType is a variable-length type containing a list of PointType elements
(x, y) and SymbolStyleType has a variable-length array of integers).
I tried several scenarios inside the IN/OUT functions and none of them
works 100%. It is either the data overlaps depending on the sizes of the variable-length
elements, or I have various memory problems (especially when doing SELECT on
a column containing this type).
I tried to use an additional "void *data" member at the end, where to dump all the
variable contents and retrieve them when needed, but I could not make it work at all.
Anybody tried to do do something similar and want to share some thoughts on this one?
Best regards, Jean
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org