ptree is a PostgreSQL extension implementing ptree, a variant of the ltree data type. The ltree type is used for representing labels of data stored in a hierarchical tree-like structure. The ptree data type uses a forward slash '/' as a separator for the hierarchy and also allows the characters '`' and '-' inside labels.
ptree requires PostgreSQL 9.1+ including development header files (normally postgresql-server-dev package or similar).
The source code for ptree can be obtained by either downloading a source package from the Bitbucket repository or by cloning it with:
$ hg clone https://bitbucket.org/aschreyer/ptree
The extension can be built and installed with:
$ make $ sudo make install
This will build and install the shared library in the PostgreSQL server library directory. The extension can then be installed in the server by executing the following commands in PostgreSQL (e.g. psql or GUI tool):
$ CREATE EXTENSION ptree;
ptree, being a variant of the ltree contrib module, is released under the PostgreSQL License.