Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBU2YIL62605 for ; Fri, 29 Dec 2000 21:34:18 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBSF80L11710 for ; Thu, 28 Dec 2000 10:08:00 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.9.3/8.9.3) id JAA80332 for pgsql-sql@postgresql.org; Thu, 28 Dec 2000 09:45:32 -0500 (EST) (envelope-from news) X-Authentication-Warning: news.tht.net: news set sender to using -f From: Ron Peterson X-Newsgroups: comp.databases.postgresql.sql Subject: Re: How to represent a tree-structure in a relational database Date: Thu, 28 Dec 2000 09:45:32 -0500 Organization: Yellowbank Lines: 22 Message-ID: <3A4B520C.98F98689@yellowbank.com> References: <3A4B4D8C.9E542934@yellowbank.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.tht.net 978014732 80329 138.110.30.68 (28 Dec 2000 14:45:32 GMT) X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.4.0-test9 i686) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200012/303 X-Sequence-Number: 643 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-