TreeTraversal icon indicating copy to clipboard operation
TreeTraversal copied to clipboard

do you happen to have a 'delete' that removes any leafs also?

Open ghost opened this issue 8 years ago • 2 comments

perhaps a new function CALL r_tree_traversal('deleteall', pnode, NULL);

ghost avatar Aug 28 '17 05:08 ghost

Delete proces is just one-by-one. I did not have situation where I neded to delete all leafs in branch at once. But I understand it may be usable.

werc avatar Sep 14 '17 21:09 werc

On line 59 of r_tree_traversal, it checks if this node has any leafs. This is done by the SELECT .. INTO on line 53 and 54. "has_leafs" is the equation of rgt - lft. If a node has no leafs or children, then rgt - lft will always equal 1. If a node does have children or leafs, then rg - lft will always be > 1.

So shouldn't line 59 be IF (has_leafs > 1) THEN.. ?

That would allow the deletion of both individual nodes (A leaf node) and nodes that also have children/leafs

jmjuju avatar Sep 21 '17 04:09 jmjuju