pg_smolid
pg_smolid · A Postgres pgrx extension adding smolid type and helper functions.
Overview
PostgreSQL · 13, 14, 15, 16, 17, 18
Usage
Sources:
pg_smolid 0.1.0 adds the smolid data type and generators backed by the Rust smolid crate. Values have a compact text representation, compare by their underlying unsigned 64-bit value, and support B-tree and hash indexes.
Core Workflow
Use smolid() for a new value or smolid_with_type(integer) to request an encoded type value. smolid_type(smolid) returns that optional type; smolid_version(smolid) returns the format version. smolid_to_bigint(smolid) and smolid_to_text(smolid) expose the numeric and textual forms.
Type Behavior and Caveats
The extension defines comparison operators, default B-tree and hash operator classes, and implicit casts from smolid to bigint and text. Ordering follows the encoded integer, not locale text order. The control file marks installation superuser-only and untrusted. Pin the extension and Rust crate versions across nodes, and validate serialization plus sort behavior before using the type in durable keys or logical replication.