Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Chris Travers
On Wed, Aug 7, 2013 at 11:38 PM, Alban Hertroys wrote: > On Aug 8, 2013, at 4:11, Sergey Konoplev wrote: > > > create table node as ( > > id integer primary key, > > r integer, s integer, > > children integer[] element references node > > ); > > > > so you could download 9.3rc2 and experimant

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Sergey Konoplev
On Wed, Aug 7, 2013 at 11:38 PM, Alban Hertroys wrote: > On Aug 8, 2013, at 4:11, Sergey Konoplev wrote: >> create table node as ( >> id integer primary key, >> r integer, s integer, >> children integer[] >> ); >> >> and check integrity by triggers. > > > Or, instead of attempting to reference

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Alban Hertroys
On Aug 8, 2013, at 4:11, Sergey Konoplev wrote: > create table node as ( > id integer primary key, > r integer, s integer, > children integer[] element references node > ); > > so you could download 9.3rc2 and experimant with it. > > Now (on <=9.2.x) you can create the table without FK > >

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Sameer Thakur
> > On Wed, Aug 7, 2013 at 4:57 AM, 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 []);

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Sergey Konoplev
On Wed, Aug 7, 2013 at 7:11 PM, Sergey Konoplev wrote: > so you could download 9.3rc2 and experimant with it. Sorry, 9.3beta2 of course. -- Kind regards, Sergey Konoplev PostgreSQL Consultant and DBA http://www.linkedin.com/in/grayhemp +1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979 gr

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Sergey Konoplev
On Wed, Aug 7, 2013 at 4:57 AM, Sameer Thakur wrote: > 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

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread David Johnston
Igor Neyman wrote >> >> create type node as (r integer, s integer); alter type node add attribute >> children node[]; >> > > Under 9.2.2 I'm getting an error: > > ERROR: composite type node cannot be made a member of itself I'm not sure why the limitation exists (probably something to do with

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Igor Neyman
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of David Johnston > Sent: Wednesday, August 07, 2013 10:35 AM > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Self referencing composite da

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread David Johnston
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 exis

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Chris Travers
On Wed, Aug 7, 2013 at 4:57 AM, 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