Re: [SQL] celko nested set functions -- tree move

2002-11-26 Thread Martin Crundall
Hi Robert; The math actually works either way; if it goes negative, the offset is positive, which is okay. Your selects are way more elegant. I guess I was just raising the point that using a key other than lft (which tends to move around in an active tree), is probably safer. The table lock

Re: [SQL] celko nested set functions -- tree move

2002-11-26 Thread Robert Treat
I think you should take a closer look at Greg's function. It is uses lfts as parameters in the function mainly just to make the function implementation independent; I was able to easily adapt it to my schema which uses unique id's for each object in the tree hierarchy. After looking your function

[SQL] celko nested set functions -- tree move

2002-11-25 Thread Martin Crundall
I'm not sure that keying off lft is safe in a multi-user environment. I opted to create and use an objid on the tree definition table, since its identity is static. I also found that when trees get active, allowing for tree IDs increased operation speed quite a bit (i actually push this to two le

Re: [SQL] celko nested set functions

2002-11-25 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message Robert Treat and I came up with a better way to move nodes from one branch to another inside of a nested tree: CREATE or REPLACE FUNCTION move_tree (integer, integer) RETURNS text AS ' -- Mov

Re: [SQL] celko nested set functions

2002-10-29 Thread greg
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message > I'm wondering if anyone has written code that enables you to move > entities between parents in a nested set model. Specifically something > that can do it without deleting any of the children i

Re: [SQL] celko nested set functions

2002-10-02 Thread Josh Berkus
Robert, > I'm wondering if anyone has written code that enables you to move > entities between parents in a nested set model. Specifically something > that can do it without deleting any of the children involved in the > process. I looked in the postgresql cookbook which had adding and > buildin

[SQL] celko nested set functions

2002-10-02 Thread Robert Treat
I'm wondering if anyone has written code that enables you to move entities between parents in a nested set model. Specifically something that can do it without deleting any of the children involved in the process. I looked in the postgresql cookbook which had adding and building tree's, but not m