ltree
data type for hierarchical tree-like structures
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
ltree | 1.3 | TYPE | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3960 | ltree | No | Yes | No | Yes | Yes | No | - |
| Related | age pg_liquid onesparse graph pgrdf ltree_plpython3u prefix ip4r seg cube |
|---|---|
| Depended By | fsm_core ltree_plpython3u |
Version
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.3 | 1.3 | 1.3 | 1.3 | 1.3 |
Install
Note: This is a built-in contrib extension of PostgreSQL
Usage
The ltree extension provides data types for hierarchical tree-structured data with extensive search facilities.
Data Types
ltree: Label path (e.g.,Top.Science.Astronomy)lquery: Regex-like pattern for matching ltree valuesltxtquery: Full-text-search-like pattern
Basic Usage
Operators
| Operator | Description |
|---|---|
@> | Is ancestor of (or equal) |
<@ | Is descendant of (or equal) |
~ | Matches lquery pattern |
? | Matches any lquery in array |
@ | Matches ltxtquery |
|| | Concatenate paths |
lquery Patterns
Functions
Index Support
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)