pg_data_retention
pg_data_retention · PostgreSQL background-worker extension that applies table data retention policies.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100864 | pg_data_retention | pg_data_retention | 0.0.0 | ADMIN | MIT | Rust |
PostgreSQL · 13, 14, 15, 16, 17, 18
Usage
Sources:
- Prototype README at the reviewed commit
- Extension control file
- Background-worker source
- Cargo feature matrix
pg_data_retention is a version 0.0.0 background-worker experiment that deletes rows according to entries in public.data_retention_policy. It must be present in shared_preload_libraries, followed by a server restart.
Destructive Prototype Warning
At startup, current source connects to the postgres database, drops public.data_retention_policy if it exists, and recreates it. The orchestrator wakes every ten seconds, launches deletion workers sequentially, and panics on an SQL failure. The documented cron_schedule field is not implemented, and the repository explicitly lists missing worker and cross-version tests.
Do not preload this code on a server containing valuable data. Rebuilding the policy table destroys configuration, and a mistaken table, timestamp column, retention period, or batch size can delete application rows. Treat the source only as a prototype to audit and redesign in an isolated environment.