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-dtr | No | Yes | No | Yes | yes | yes |
| Relationships | |
|---|---|
| Need By | fsm_core ltree_plpython3u ltree_plruby pg_statecharts |
| See Also | age pg_liquid onesparse graph pgrdf ltree_plpython3u prefix ip4r seg cube |
Packages
| PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|
| 1.3 | 1.3 | 1.3 | 1.3 | 1.3 |
This contrib extension ships with PostgreSQL.
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 |