Re: How to represent a tree-structure in a relational database - Mailing list pgsql-sql

From Ron Peterson
Subject Re: How to represent a tree-structure in a relational database
Date
Msg-id 3A4B520C.98F98689@yellowbank.com
Whole thread Raw
In response to RE: How to represent a tree-structure in a relational database  ("Stuart Statman" <stu@slammedia.com>)
List pgsql-sql
Ron Peterson wrote:
> 
> CREATE TABLE category_edge (
>         parent  INTEGER
>                 NOT NULL
>                 REFERENCES category_node(id),
> 
>         child   INTEGER
>                 NOT NULL
>                 REFERENCES category_node(id)
> );

Just for the sake of anal-retentive completeness, I'd like to point out
that you'd probably want an id field in this table also.  Plus what the
heck else am I going to do on Christmas break?  ;)

On a completely unrelated topic: getting the PostgreSQL discussions
lists on a news server is great!!!  I was overwhelmed with mail that I
usually don't have time to deal with.  Now when I have a chance, I just
go see what's up on the news server.  Excellent and thanks!

-Ron-


pgsql-sql by date:

Previous
From: Ron Peterson
Date:
Subject: Re: Tree structure table normalization problem (do I need a trigger?)
Next
From: Ron Peterson
Date:
Subject: Re: How to represent a tree-structure in a relational database