Re: How to store directory like structures?

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Axel Straschil <axel(at)straschil(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to store directory like structures?
Date: 2005-04-03 17:00:05
Message-ID: Pine.GSO.4.62.0504032059420.15865@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 3 Apr 2005, Axel Straschil wrote:

> Hello!
>
> I want to store some structure like:
>
> CREATE TABLE node
> (
> nodeid SERIAL PRIMARY KEY,
> parent INT REFERENCES node(nodeid)
> ON UPDATE CASCADE ON DELETE CASCADE,
> label TEXT,
> UNIQUE (parent, label),
> ...
> data
> ...
> );
>
> The label is used to map a node to a directory like strukture, so i can
> have a function directory_for(nodeid) which gives me
> /root_label/parent_label/parent_label/my_label (root labels have NULL as parent)
>
> The problem is the ammount of queries when i've got deep nodes, and I
> often have to query if a node is "in path" of another node.
>
> Is there a good solution to build directory-tree like datastruktures?
> I found, http://www.sai.msu.su/~megera/postgres/gist/ltree/ which seems
> to do what i want, but I've no idea (and probalbly no chance) to get
> that running on my system ;-(

what's a problem with ltree ?

>
> Thanks,
> AXEL.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Axel Straschil 2005-04-03 17:26:03 Re: How to store directory like structures?
Previous Message Yasir Malik 2005-04-03 13:45:49 Re: Date/Time Conversion