A functions library to manipulate trees and hierarchical structures under PL/pgSQL.

The main idea is to separate the real data from the hierarchical information. This can be achieved by using custom, user created tables to store the real data and by using this library for the hierarchical information. The library stores the hierarchical information in its internal structure, the user then, can access this information by using these functions and it is also able to create views that combine the real data with the hierarchical information.

the library is available for download from pgfoundry: pgtreelib downloads


  • add/remove Nodes
  • remove subtrees
  • tree traversal
  • tree level traverse
  • xml/html tree conversion
  • user access per node
  • import/export tree structures
  • get path from root to node
  • get anchestor of 2 nodes