pgtime
pgtime · Temporal tables extension for PostgreSQL. Automatically tracks Transaction Time (system time) on any table using range types and a high-performance C-based AFTER ROW trigger.
Overview
Usage
Sources:
- Official upstream README
- Official extension control file (pgtime.control)
- Official extension SQL (pgtime–0.1.sql)
pgtime — Temporal tables extension for PostgreSQL. Automatically tracks Transaction Time (system time) on any table using range types and a high-performance C-based AFTER ROW trigger. Use it for the corresponding scheduling, temporal, or time-series workflow. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.
Core Workflow
Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.
Important Objects
pgtime.as_of(target_table TEXT, ts TIMESTAMPTZ)is an extension function and returnsSETOF.pgtime.attach(target_table TEXT)is an extension function and returnsVOID.pgtime.detach(target_table TEXT)is an extension function and returnsVOID.pgtime.diff(target_table TEXT, t1 TIMESTAMPTZ, t2 TIMESTAMPTZ)is an extension function and returnsSETOF.pgtime.history(target_table TEXT, row_id anyelement)is an extension function and returnsSETOF.pgtime.pgtime_trigger_fn()is an extension function and returnsTRIGGER.pgtime.versions(target_table TEXT, row_id anyelement)is an extension function and returnsBIGINT.pgtimeis a schema created by the extension.
Requirements and Caveats
- The reviewed control file declares default version
0.1. - The control file marks the extension as relocatable.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.