Skip to content

pg_uom

Unit conversions with dimensional and affine checks.

pg_extensions · Unit conversions with dimensional and affine checks.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102091pg_uompg_extensions0.3.0FUNCMatroid-SAL-1.0Rust

PostgreSQL · 14, 15, 16, 17

Usage

Sources:

pg_uom 0.3.0 stores unit categories and definitions in pguom, supporting scalar and compound-unit conversions with dimensional checks.

Core Workflow

CREATE EXTENSION pg_uom;
SELECT pguom.seed_si();
SELECT pguom.convert(1.0, 'kg', 'lb');
SELECT pguom.convert(0.0, 'degC', 'degF');

Operational Boundaries

The control does not require superuser-only installation, but object-creation privileges still apply. No preload is required. seed_si initializes units; create_category, create_unit, list_units and compatible_units manage the catalog. Temperature offsets work for simple conversions, while compound temperatures are rejected. Cross-dimension conversions fail. pg_uom.enabled can disable conversion and return the unchanged input, so applications must control that setting and not assume every successful call transformed the value. This is an unsupported proof of concept under Matroid Source Available License 1.0. APIs may change. Version 0.3.0 is the new upgrade baseline: earlier 0.2.0 installations require a rehearsed data migration/recreation, not ordinary ALTER EXTENSION UPDATE. Back up data and dependencies before following that destructive upstream path.

Table reader