Re: Joe Celko Function : problem

From: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>
To: Richard Emberson <emberson(at)phc(dot)net>
Cc: Ben-Nes Michael <miki(at)canaan(dot)co(dot)il>, pgsql-general(at)postgresql(dot)org
Subject: Re: Joe Celko Function : problem
Date: 2002-05-02 14:30:50
Message-ID: 3CD14D9A.3080205@mmrd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2002-05-02 14:32:49 Re: is there a way
Previous Message Lamar Owen 2002-05-02 14:20:43 Re: is there a way