From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | "Gregory Brauer" <greg(at)wildbrain(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Trees in SQL |
Date: | 2002-05-25 00:04:01 |
Message-ID: | 011501c2037f$ad4b5340$9865fea9@Allan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Try here maybe:
http://cddb.sai.msu.su/~megera/postgres/gist/
Look at their new 'tree' module...
Chris
----- Original Message -----
From: "Gregory Brauer" <greg(at)wildbrain(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Friday, May 24, 2002 11:08 AM
Subject: [SQL] Trees in SQL
>
> I hope this isn't an overly broad topic that ends up diverging into graph
> theory, but I have a tree structure of identical items (analogous to a
> filesystem directory tree) that I need to store in Postgres. The
> "obvious" design is to give the table that will represent these objects
> a field identifying its "parent" that is a relation to the same table.
> However, this seems to make many common SQL queries rather difficult.
>
> What sort of strategies are best for storing tree structures in a
> relational database, and how would one structure SQL queries to find,
> say, "all of the children anywhere under this node", or to represent
> the condition "if this node is a child at any depth under this other
> node"? Are there good strategies for preventing cycles?
>
> I'd appreciate any insights anyone can give.
>
> Thanks.
>
> Greg Brauer
> greg(at)wildbrain(dot)com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel Dovalo Carril | 2002-05-25 01:11:01 | Re: Functions with dynamic queries |
Previous Message | Oleg Bartunov | 2002-05-24 20:46:27 | Re: Trees in SQL |