pg_dirty_hands
pg_dirty_hands · Provides functions to freeze individual heap tuples, including an unlogged variant.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100589 | pg_dirty_hands | pg_dirty_hands | 1.0 | ADMIN | Unknown | C |
Usage
Sources:
pg_dirty_hands exposes low-level functions that rewrite a single heap tuple’s visibility metadata. It copies PostgreSQL 9.6-era vacuum/freezing internals and deliberately bypasses normal MVCC safeguards. Use it only for expert forensic or recovery experiments on a disposable copy; an incorrect relation or stale CTID can corrupt data, indexes, backups, and replicas.
Lock Down Installation
The C code performs no independent superuser check, while extension functions can be executable by PUBLIC. Revoke access immediately after installation and grant it only to a dedicated emergency role:
Do not grant freeze_tuple_unlogged(regclass, tid) for normal use.
Important Objects
freeze_tuple(regclass, tid, boolean)freezes one tuple identified by its physical CTID. With the defaultfalse, it follows the source’s limited eligibility checks; withtrue, it forcibly marks the insert transaction frozen and invalidates delete/update metadata.freeze_tuple_unlogged(regclass, tid)changes tuple headers without marking the buffer dirty and without WAL. Despite its name, the implementation does not verify that the relation is unlogged.
Extreme-Risk Boundary
Upstream reports testing only PostgreSQL 9.6.3 through 9.6.6. The implementation is coupled to heap-page layout, buffer handling, WAL records, and transaction-header bits from that generation. Never assume binary or semantic compatibility with another PostgreSQL release. Stop writes, preserve a physical copy, verify the exact tuple and page with forensic tools, and rehearse recovery before any call. Never use the true force path or the unlogged function on a production primary. A boolean success result is not proof that logical visibility, indexes, replicas, or future vacuum operations remain valid.