pair
pair · A key/value pair data type for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100059 | pair | pair | 0.1.2 | TYPE | PostgreSQL | C |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
Usage
Sources:
pair adds a small ordered key/value composite type. Both fields are text; its main use is passing an ordered variadic list of pairs to a function without adopting a larger container such as hstore or JSON.
Core Workflow
Construct a value with pair() or the ~> operator, then access its k and v fields:
The overloads accept text and polymorphic anyelement arguments, but the resulting composite still stores each value as text.
Variadic Use
The type is especially useful as a variadic function parameter:
Important Objects and Notes
- Type:
pair, with fieldsk textandv text. - Constructors:
pair(anyelement, text),pair(text, anyelement),pair(anyelement, anyelement), andpair(text, text). - Operator: matching
~>overloads that call the constructors.
pair has no runtime dependency beyond PostgreSQL, is relocatable, and needs no preload or restart. PGXN distribution 0.1.8 still declares the provided SQL extension version as 0.1.2, matching the catalog version; the distribution update is not an extension-schema version bump.