ltree
data type for hierarchical tree-like structures
ltree : data type for hierarchical tree-like structures
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3960 | ltree | ltree | 1.3 |
TYPE | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-dt- | No | Yes | No | Yes | no | yes |
| Relationships | |
|---|---|
| Need By | fsm_core ltree_plpython3u |
| See Also | age pg_liquid onesparse graph pgrdf ltree_plpython3u prefix ip4r seg cube |
Packages
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.3 | 1.3 | 1.3 | 1.3 | 1.3 |
This is a built-in contrib extension ship with the PostgreSQL kernel
Install
Create this extension with:
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 |