That was my first guess. I used palloc everywhere.. But to be sure, after I made the type, I tried to do the something like:
mytype * result;
mytype * realResult;
result = createType(...);
realResult = (mytype *)palloc(mytype->length);
mempcy (realResult, result, result->length);
It didn't help. Is that enough?
> Subject: Re: [GENERAL] Persistence problem
> From: dalroi@solfertje.student.utwente.nl
> Date: Wed, 12 May 2010 19:05:36 +0200
> CC: pgsql-general@postgresql.org
> To: i.bre@live.com
>
> On 12 May 2010, at 18:08, I. B. wrote:
>
> > Hello.
> >
> > I have a problem. I've created several types and functions in C language and implemented them successfully. Or at least I thought so... When I insert, select, update data, everything works fine, but in that session only. As soon as I close psql and start it agan, the data is corrupted. Is there some common mistake I might have made? Code is pretty big, so I don't think it would do any good if I put it here...
>
> That sounds like what the documentation warns you about if you modify a structure directly from postgres without using palloc.
>
> Alban Hertroys
>
> --
> If you can't see the forest for the trees,
> cut the trees and you'll see there is no forest.
>
>
> !DSPAM:1077,4beadfe710418634015713!
>
>
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
Sign up now.