pgpm-pg18-shim
pgpm-pg18-shim · Opt-in SQL UUIDv7 fallback that preserves existing native functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102456 | pgpm-pg18-shim | pgpm-pg18-shim | 0.47.15 | FUNC | MIT | SQL |
PostgreSQL · 18
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
- packages/pg18-shim/README.md
- packages/pg18-shim/pgpm-pg18-shim.control
- packages/pg18-shim/sql/pgpm-pg18-shim–0.47.15.sql
- packages/pg18-shim/Makefile
- packages/pg18-shim/revert/functions/uuidv7.sql
- .github/workflows/ci.yml
- LICENSE
pgpm-pg18-shim 0.47.15 is an opt-in SQL UUIDv7 fallback. Enable it before modules that use uuidv7() in column defaults. On PostgreSQL 18 it preserves the native function. On a server without a suitable existing function it creates public.uuidv7().
Enablement
The extension requires plpgsql, is not relocatable and has no shared library or preload requirement. Its control file sets superuser=false; the installing role still needs permission to create the extension and, if needed, the function in public. Upstream CI explicitly uses PostgreSQL 18. The README describes older-server use but does not establish a minimum supported major version.
Function and compatibility
The installation checks pg_catalog and public for a function named uuidv7 callable with no supplied arguments, including functions whose arguments all have defaults. If one exists, installation leaves it intact. Otherwise the fallback combines a Unix millisecond timestamp with random UUID bits and the RFC 9562 version and variant layout. The created function is volatile, returns uuid and grants execution to PUBLIC.
This fallback has no optional time-shift argument and does not guarantee ordering within a millisecond. The generated identifiers are not a substitute for access tokens. With a fallback installed in public, keep that schema on the intended search path or call public.uuidv7() explicitly; PostgreSQL 18’s native function resides in pg_catalog.
Removal
Extension removal affects objects it created; an existing function skipped during installation is not adopted. Upstream’s separate migration revert also checks its ownership marker before dropping the fallback. Inspect dependent column defaults before removing it, and avoid cascading removal of application objects.