Re: Joe Celko Function : problem

Поиск
Список
Период
Сортировка
От Fran Fabrizio
Тема Re: Joe Celko Function : problem
Дата
Msg-id 3CD14D9A.3080205@mmrd.com
обсуждение исходный текст
Ответ на Joe Celko Function  ("Ben-Nes Michael" <miki@canaan.co.il>)
Список 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 по дате отправления:

Предыдущее
От: Thierry Besancon
Дата:
Сообщение: Re: is there a way
Следующее
От: Lamar Owen
Дата:
Сообщение: Re: is there a way