intpair
pg_intpair · Packed int64pair data type with comparison, hash, and index operator support.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100609 | intpair | pg_intpair | 0.2 | TYPE | Apache-2.0 | C |
Usage
Sources:
intpair installs a compact fixed-length base type for a pair of signed 64-bit integers. The SQL extension name is intpair, while the upstream project and package are named pg_intpair; use it when dense storage, comparison, and indexing of exactly two integers are preferable to a composite type or array.
Core Workflow
Construct values with the two-argument function or the textual pair representation. Components are addressed with zero-based subscripts.
Operators and Indexes
Version 0.2 defines equality and lexicographic ordering over the first component and then the second. It supplies default B-tree and hash operator classes, so ordinary indexes support equality, range predicates, and ordering.
Migration and Caveats
The upstream README demonstrates migration from a two-bigint composite through textual I/O. Test that conversion on a copy first, because the input must match the extension’s pair syntax and an implicit cast changes resolution for later queries.
The type is always a 16-byte pair and does not represent a variable-length list. It is relocatable and declares no preload or restart requirement. Applications should use the exact extension name intpair and type name shown in the examples rather than deriving them from the pg_intpair package name.