On Wed, Feb 23, 2005 at 02:01:36PM +0100, Kjetil Haaland wrote:
> I have made a user defined type which has a string of variable length and and
> an integer value. Since the string is of variable length i have used a
> pointer for the string. When i use this type as a column in a table and
> inserts values into it, the string will go away. I understand that this is
> because i am pointing to a place in memory for the string, and that this wont
> last for a very long time. So i am wondering how i am supposed to use strings
> in a user defined type so they will be saved in the database when the type is
> inserted in a table?
Hmmm...haven't we already had this conversation? :-)
The type's data needs to be a contiguous block of memory, preceded
by four bytes (int32) indicating the total length (including the
four bytes). You should also be aware of how TOAST works and the
need to use PG_DETOAST_DATUM in certain places.
Or have I misunderstood what you're asking?
In response to
pgsql-novice by date
|Next:||From: Kjetil Haaland||Date: 2005-02-23 19:14:06|
|Subject: Re: user defined types and strings|
|Previous:||From: Frank Bax||Date: 2005-02-23 14:08:23|
|Subject: Re: Can Clipper connect Postgresql|