Re: Closing Gaps in Celko trees

From: 71062(dot)1056(at)compuserve(dot)com (--CELKO--)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Closing Gaps in Celko trees
Date: 2002-07-31 01:46:53
Message-ID: c0d87ec0.0207301746.5bb6bac8@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-07-31 01:48:42 Re: getpid() function
Previous Message Neil Conway 2002-07-31 01:28:09 Re: Have been accepted as a writer for "The Register"