pg_surgery is a contrib module providing tools for performing corrective action on potentially corrupted data.
pg_surgery was added in PostgreSQL 14.
pg_surgery provides functions which directly modify the internal representation of individual tuples outside of the normal operating context and if used incorrectly may introduce corruption which did not previously exist.
Extreme caution is therefore necessary when using these functions. It is highly recommended to seek professional advice if you believe you need to use them but are not sure how.
As of PostgreSQL 14,
pg_surgery provides two functions:
heap_force_kill()for truncating dead tuples
heap_force_freeze()for forcing a tuple to become all-visible
Additional functionality may be added in future versions.