pg_libphonenumber
Adds a packed phone-number type and parsing functions backed by Google libphonenumber.
pg_libphonenumber · Adds a packed phone-number type and parsing functions backed by Google libphonenumber.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100050 | pg_libphonenumber | pg_libphonenumber | 0.1.0 | TYPE | Apache-2.0 | C++ |
Usage
Sources:
- Upstream README
- Version 0.1.0 install SQL
- C++ SQL-callable implementation
- Packed representation and comparison
- PGXN release metadata
pg_libphonenumber 0.1.0 provides an eight-byte packed_phone_number type backed by Google’s C++ libphonenumber, an explicit-region parser, international text output, a country-code accessor, and B-tree operators.
Parse with an explicit region
Use parse_packed_phone_number for national-format input. Direct packed_phone_number text input is hard-coded to the US region and is ambiguous for other countries.
Caveats
- Upstream labels the extension alpha and partially implemented. PGXN has only the 0.1.0 release from 2017, and the repository was last changed in 2020.
- Parsing does not call libphonenumber’s validity check. A syntactically parseable value is not evidence that a number is assigned, reachable, or appropriate for an account.
- Parsing and formatting functions are declared immutable even though results depend on the linked libphonenumber metadata version. Library upgrades can change normalized output and invalidate assumptions in stored expressions.
- The greater-than and greater-or-equal SQL operators incorrectly declare themselves as their own commutators. Planner rewrites can therefore change predicate meaning; do not rely on these operators or their B-tree class without repairing and retesting the SQL.
- Binary send and receive copy the native eight-byte object directly, without portable byte order or semantic validation. Avoid binary transfer across architectures or independently built versions.
- Ordering is an internal packed-value heuristic and is documented in source as potentially unintuitive. It is not linguistic, dialing, geographic, or numeric-string order.