Tree manipulation functions for PostgreSQL -  version 1.0beta1
=============================================================

Introduction
------------

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 he is also able to create views that combines the real data 
with the hierarchical information.

Installation
------------

First, you must have created a database in PostgreSQL.

Then, use the operation system shell, to install the  PL/pgSQL handler:

  createlang plpgsql <dbname>


Next, load  the tree_install.sql file into the 
database, eg:
 
  psql -f  tree_install.sql <dbname>




Uninstall
---------

The library consists of 2 schemas: 
tree and tree_util

To uninstall:
drop these schemas like this:
drop schema tree CASCADE;
drop schema tree_util CASCADE;

If you do this you will loose your tree structures 
that you have registered in the library.



Usage
-----

The library consists of 2 schemas:

1. tree      : this schema holds the user functions. 
               Also it holds the tables and triggers which store 
               the nodes responsible for hierarchical structure information.

2. tree_util : this schema holds the functions required for internal usage.


Have a look at functions.txt for a list of functions and data structures.
Also have a look at tutorial.sql for a tutorial about the library usage and views construction.



Todo
----
1) Documentation.
2) Add user access restrictions functionality.
3) Examine the possibility to add a bigint[] column for storing the path to root for every node.
4) Examine the possibility to use the ltree data type from postgres contrib for storing 
   the hierarchical information.  	 



Contact
-------
Author: Kostas Maistrelis <pgtreelib@altsol.gr>

I will be glad to hear any comments or suggestions here: <pgtreelib@altsol.gr>

