Re: Self referencing composite datatype

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Self referencing composite datatype
Дата
Msg-id 1375886077626-5766651.post@n5.nabble.com
обсуждение исходный текст
Ответ на Self referencing composite datatype  (Sameer Thakur <samthakur74@gmail.com>)
Ответы Re: Self referencing composite datatype  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-general
Sameer Thakur wrote
> Hello,
> I wanted to create a composite datatype to represent a Node. So it would
> have a few attributes and an array of type Node which is the children of
> this node.
> create type Node as (r integer, s integer, children Node []);
> But i get error type Node[] does not exist. I understand that Node is not
> defined hence the error.
> But how do i get around this problem?

In theory if you are using 9.1 or later you can first create the node type
and then alter it to include a children attribute with the self-referencing
type-array.

begin;

create type node as (r integer, s integer);
alter type node add attribute children node[];

end;

I'm running 9.0 so cannot readily test this at the moment.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Self-referencing-composite-datatype-tp5766635p5766651.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: Chris Travers
Дата:
Сообщение: Re: Self referencing composite datatype
Следующее
От: Seref Arikan
Дата:
Сообщение: Pl/Python runtime overhead