pgx_ulid
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4510 | pgx_ulid | No | Yes | Yes | Yes | No | No | - |
shared_preload_libraries = pgx_ulid is only required for gen_monotonic_ulid(); other functions work without it.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.3 | 1817161514 | pgx_ulid | - |
| RPM | PIGSTY | 0.2.3 | 1817161514 | pgx_ulid_$v | - |
| DEB | PIGSTY | 0.2.3 | 1817161514 | postgresql-$v-pgx-ulid | - |
Build
You can build the RPM / DEB packages for pgx_ulid using pig build:
Install
You can install pgx_ulid directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
pgx_ulid provides a native ulid type, generators, and casts to and from timestamp and uuid. The README documents binary storage and monotonic ULID support. The pgext catalog tracks package and extension name pgx_ulid, version 0.2.3, for PostgreSQL 14-18.
Enable the extension
Generate ULIDs
gen_monotonic_ulid() needs:
The README explicitly says this preload requirement only affects gen_monotonic_ulid(); the rest of the extension works without it.
Use ulid as a primary key
Casts and range queries
The README also documents casts between ulid and uuid.
Caveats
- Monotonic ULIDs use shared memory plus an LWLock to keep the last generated value.
- The README notes that monotonic generation can theoretically overflow and raise an error, although it treats this as negligible in practice.
- The upstream README also shows
CREATE EXTENSION ulid; this stub followsdb/extension.csv, where the package and lead extension are bothpgx_ulid. - The GitHub release page lists
v0.2.3as latest and only labels itRelease 0.2.3, with no separate user-facing release notes.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)