Re: Pointers in custom types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Pointers in custom types
Дата
Msg-id 27426.1235238295@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Pointers in custom types  (Will Harrower <wjh105@doc.ic.ac.uk>)
Ответы Re: Pointers in custom types  (Will Harrower <wjh105@doc.ic.ac.uk>)
Список pgsql-general
Will Harrower <wjh105@doc.ic.ac.uk> writes:
> I'm writing a custom type in C that needs to manage two byte arrays
> (among other things). I have attempted to implement this using something
> similar to the following struct (along with corresponding input and
> output functions):

> typedef struct example {
>     bytea* first;
>     bytea* second;
> } example;

You can't do that; the value of a datatype has to be a single chunk of
memory, and it has to be independent of exactly where it's stored
because it will get copied around without modification.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Fixing invalid owners on pg_toast tables in 8.3.5
Следующее
От: Will Harrower
Дата:
Сообщение: Re: Pointers in custom types