Re: user defined types and strings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no>
Cc: Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-novice(at)postgresql(dot)org
Subject: Re: user defined types and strings
Date: 2005-02-23 23:43:43
Message-ID: 23431.1109202223@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message ravi shankar 2005-02-24 05:54:34 Transposing a table
Previous Message George Weaver 2005-02-23 22:34:47 Re: shutdown postmaster question