recall
pg_recall · Tracks table changes in per-table _log tables for timestamp-based history queries.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100029 | recall | pg_recall | 0.9.6 | TIME | PostgreSQL | SQL |
PostgreSQL · 10, 11, 12, 13, 14, 15, 16, 17, 18
| Relationships | |
|---|---|
| Requires | btree_gist plpgsql |
Usage
Sources:
recall keeps full-row temporal history for selected PostgreSQL tables. A trigger copies each version to a per-table log with a timestamp range, allowing point-in-time queries within a configured retention interval. It is a user-data safety net, not a backup or tamper-resistant audit log.
Core Workflow
The extension requires btree_gist, and the target table must have a primary key. Enable history, modify data normally, and ask recall to create a session-local past view:
The log can also be queried directly with _log_time @> timestamp.
Important Objects
recall.enablecreates the template and log tables, copies existing rows, and installs the history trigger.recall.atcreates a temporary view named with the_pastsuffix for one timestamp.recall.cleanupandrecall.cleanup_alldelete versions older than the configured interval.recall.disableremoves history machinery and permanently drops that table’s retained log._log_timeis atstzrange; a GiST exclusion constraint prevents overlapping versions for the same primary key.
Operational Notes
Each change stores a full row, increasing storage, WAL, and write cost. Cleanup is manual. Schema changes must be applied through the generated template table, while log tables do not inherit ordinary constraints or foreign keys. The log is directly mutable by privileged users and is not evidence against tampering. Test primary-key changes and modern PostgreSQL compatibility carefully; always keep independent backups.