Complex/elaborate user-defined base types

From: Jean-Henry Berevoescu <berevoescu(at)sbcglobal(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Complex/elaborate user-defined base types
Date: 2003-10-21 14:19:18
Message-ID: 3F954066.3090806@sbcglobal.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Brusser 2003-10-21 14:50:54 Automatic conversion from Unicode
Previous Message Tom Lane 2003-10-21 14:13:00 Re: [HACKERS] obj_description problems?