Re: Closing Gaps in Celko trees - Mailing list pgsql-general

From 71062.1056@compuserve.com (--CELKO--)
Subject Re: Closing Gaps in Celko trees
Date
Msg-id c0d87ec0.0207301746.5bb6bac8@posting.google.com
Whole thread Raw
In response to Closing Gaps in Celko trees  ("Ben-Nes Michael" <miki@canaan.co.il>)
List pgsql-general
>> Im trying to convert one of the functions the Celko wrote for closing gaps
in lft,rgt tree type. <<

I have a better way now:

CREATE VIEW LftRgt (i)
AS SELECT lft FROM Tree
   UNION ALL
   SELECT rgt FROM Tree;

UPDATE Tree
   SET lft = (SELECT COUNT(*)
                FROM LftRgt
               WHERE i <= lft),
       rgt = (SELECT COUNT(*)
                FROM LftRgt
               WHERE i <= rgt);

pgsql-general by date:

Previous
From: Joey Gartin
Date:
Subject: Client Admin Tools
Next
From: John Burski
Date:
Subject: Re: Have been accepted as a writer for "The Register"