Hi,
I realize that a relational database may not be ideal for storing (and
retrieving) tree-like strucutres, but it looks like you guys are doing
with PostgreSQL the impossible anyway.
Having table t of all nodes:
CREATE SEQUENCE nodeIDseq START 1;
CREATE TABLE t(
id int
I'll be curious to see the responses to this. I myself deal with this same
situation every day. Although we're currently using MySQL but moving it to
postgres (which is why I'm on these lists..)
-- select a tree starting with node 1234 and all its descendants:
SELECT * FROM t WHERE id=1234
Guys,
Check out Joe Celko's two chapters on tree structures in the 2nd edition of
SQL for Smarties. It's pretty comprehensive.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
---(end of broadcast)---
TIP 6: Have you searched our list
folk,
have you looked at ltree ?
http://www.sai.msu.su/~megera/postgres/gist/ltree/
Regards,
Oleg
On Fri, 9 Aug 2002, Adam Erickson wrote:
I'll be curious to see the responses to this. I myself deal with this same
situation every day. Although we're currently using MySQL but