Re: user defined types and strings - Mailing list pgsql-novice

From Tom Lane
Subject Re: user defined types and strings
Date
Msg-id 23431.1109202223@sss.pgh.pa.us
Whole thread Raw
In response to Re: user defined types and strings  (Kjetil Haaland <kjetil.haaland@student.uib.no>)
List pgsql-novice
Kjetil Haaland <kjetil.haaland@student.uib.no> writes:
> On Wednesday 23 February 2005 18:23, Michael Fuhr wrote:
>> Hmmm...haven't we already had this conversation? :-)

> We have had almost the same conversation before. The type works in my
> functions, but since the string is just a pointer to a memory place it goes
> away when the type is stored in tables in the database.

The point here is that you've built a two-part structure:

    <length> <pointer to string> <some other fields>
                    |
                    +------------> text of string

and this is fundamentally not going to work.  A datum has to be one
piece of memory.  Consider something like

    <length> <some other fields> <text of string>

where the length is now variable.

            regards, tom lane

pgsql-novice by date:

Previous
From: George Weaver
Date:
Subject: Re: shutdown postmaster question
Next
From: Thomas Hallgren
Date:
Subject: Re: Question on TRUNCATE privleges