TreeTraversal
TreeTraversal copied to clipboard
do you happen to have a 'delete' that removes any leafs also?
perhaps a new function CALL r_tree_traversal('deleteall', pnode, NULL);
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.
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