lpathtree
Hierarchical path types using slash-separated labels
lpathtree · Hierarchical path types using slash-separated labels
Overview
Usage
Sources:
lpathtree is a fork of PostgreSQL’s ltree module that uses / between labels. It is useful for materialized paths that need slash syntax or label characters such as {, }, !, and *, at the cost of removing the original ltxtquery feature.
Core Workflow
Store paths in the lpathtree type and add a GiST index for ancestor, descendant, and path-query operators.
Main Objects
lpathtreeandlpathqueryare the path and pattern types.@>and<@test ancestor and descendant relationships;~matches anlpathquery;||concatenates paths.nlevel,subpath,index, andlcaexpose depth, slicing, subpath search, and lowest-common-ancestor operations.- The extension provides B-tree ordering and GiST operator classes for scalar paths and path arrays.
Compatibility Boundary
This code was forked from an older PostgreSQL ltree implementation. Slash-separated values are not interchangeable with dot-separated ltree values, and ltxtquery is deliberately absent. Treat migration from ltree as a data and query rewrite, and validate this old C extension on the exact PostgreSQL major version before production use.