Re: Joe Celko Function : problem - Mailing list pgsql-general

From Fran Fabrizio
Subject Re: Joe Celko Function : problem
Date
Msg-id 3CD14D9A.3080205@mmrd.com
Whole thread Raw
In response to Joe Celko Function  ("Ben-Nes Michael" <miki@canaan.co.il>)
List pgsql-general
Richard Emberson wrote:
> Ben-Nes,
>
> One problem with the nested set approach is that you have to make sure that the
> root set of
> each hierarchy has upper and lower bounds that do not overlap with those of any
> other
> root set.

Not sure what you mean here.  If you mean the set of left's and right's taken together must not have any duplicate
values,yes.  
This is the basic premise of the nested set, moreso than a problem. :-)

> What I have yet to do is write the code that "reallocates" a root set's range,
> which
> would require getting all child nodes and adjusting their bounds .... but this
> is not really
> that hard since it is just adding/subtracting values to all their bounds.

This is exactly what Joe Celko's pseudocode and the actual code I posted earlier in the thread do, if I understand you
correctly. 
  Notice it's reallocating lft's and rgt's in response to a deleted node.

Hope that helps,
Fran


pgsql-general by date:

Previous
From: Thierry Besancon
Date:
Subject: Re: is there a way
Next
From: Lamar Owen
Date:
Subject: Re: is there a way