Re: Problem with Nested Sets

From: loufoque <mat.wilmots.remove_at_nospam.wanadoo.fr>
Date: Thu, 24 Feb 2005 00:48:27 +0100
Message-ID: <421d15b2$0$8095$636a15ce_at_news.free.fr>


-CELKO- wrote:

> Fields are not columns

Well if "field" is data, then I meant "column".

> and you have mixed data in one table. This is
> all you need for the structure table; the nodes will be in another
> table.

I only have a column of data (label), is this really needed ? (btw, I don't understand your request, the "ON UPDATE CASCADE" part, and i'm not sure about the "REFERENCES" part either)

> left and right are reserved words.

It was an example, didn't realize it was reserved. I didn't actually create the table and input data.

> The level can be computed from the (lft, rgt) pairs.

I think it needs a join.
I thought I could put it as a column for performance, as it is easy to just add it when adding a child.

> Since you did not
> post any DDL or sample I have no idea what label means.

The label is the forum name, a VARCHAR (the nodes are actually forums, subforums, etc.)
Seemed obvious to me.

> To get all the superiors of a node,use this query:
> [...]

My question is how to get a node from a path of labels like this : comp.databases.theory
"theory" is a subforum of "databases" which is a subforum of "comp". "." is the separator here, but I could use "/" for the path instead. So I want to get the node from the label of its ancestors and itself.

I don't know the node, I only know its label, and multiple nodes can have the same label if they don't have the same parent (just like directories).

I think that maybe I should use materialized paths instead of nested sets, but I don't know much about it.

Sorry but I don't think I will buy your book. I'm just an amateur and the Internet should be enough for me to get info. Moreover I live in France in shipping from USA is probably high, and it's not like my understanding of english is perfect.

Thanks anyway for your help. Received on Thu Feb 24 2005 - 00:48:27 CET

Original text of this message