From: | Tulassay Zsolt <zsolt(at)tek(dot)bke(dot)hu> |
---|---|
To: | Frank Joerdens <frank(at)joerdens(dot)de> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Tree structure table normalization problem (do I need atrigger?) |
Date: | 2000-12-19 17:56:24 |
Message-ID: | Pine.LNX.4.10.10012191851540.25931-100000@tek.tek.bke.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 19 Dec 2000, Frank Joerdens wrote:
> Tulassay Zsolt wrote:
> [ . . . ]
> > The SQL stuff of that nested set structure is fairly easy, I wrote some
> > quick'n'dirty plpgsql functions that will do inserts, updates, deletes
> > from the tree, display level number etc.
>
> What scared me about it in particular was one scenario where you try to delete a subtree.
> This would normally leave a gap, since the structure is based on the worm's ability to get
> from one node to the next with an increment of just 1. Once you had a subtree deleted,
> you'd either would have to have the worm leap-frog (a leaping frog-worm?!! :)) the gap or
> update an entire half of the tree to close it . . . then my brain started to hurt and I
> gave up.
>
that's exactly why i wrote a deletion function which updates the nodes'
"left" and "right" values to close the gap.
sure it causes a bit of overhead to update many nodes, but if you
don't delete subtrees all the time, you can live with this.
Zsolt Tulassay
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Joerdens | 2000-12-19 18:43:57 | Re: Tree structure table normalization problem (do I need a trigger?) |
Previous Message | Volker Paul | 2000-12-19 17:54:43 | Create table doesn't work in plpgsql |