Re: user defined types and strings
От | Kjetil Haaland |
---|---|
Тема | Re: user defined types and strings |
Дата | |
Msg-id | 200502232014.06872.kjetil.haaland@student.uib.no обсуждение исходный текст |
Ответ на | Re: user defined types and strings (Michael Fuhr <mike@fuhr.org>) |
Ответы |
shutdown postmaster question
Re: user defined types and strings |
Список | pgsql-novice |
On Wednesday 23 February 2005 18:23, Michael Fuhr wrote: > Hmmm...haven't we already had this conversation? :-) > > http://archives.postgresql.org/pgsql-novice/2004-11/msg00096.php > http://archives.postgresql.org/pgsql-novice/2004-11/msg00106.php > > 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. > > http://www.postgresql.org/docs/8.0/static/xtypes.html > http://www.postgresql.org/docs/8.0/static/storage-toast.html > > Or have I misunderstood what you're asking? 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. I have read about the TOAST stuff, and think i have to use this because i have a pointer, and that the actual values have to be found elsewhere. Is this correct? But i don't understand how this is used. I have tried to add the line pg_detoast_datum((struct varlena*) DatumGetPointer(result)); in my input function after i have allocated the memory for the structure and the string. I also set the length variable before i do this. But it still want save what's in the string. I have also tried to add it in the output function right after i have recieved the argument. But this doesn't help. Is there any examples i can look at to see how TOAST is used? thanks for all the help so far! -Kjetil
В списке pgsql-novice по дате отправления: