hn.today

Muhammad Aqeel: Undo for Postgres, without losing the rest of your day

pgedge.com3 points0 comments
Screenshot of Muhammad Aqeel: Undo for Postgres, without losing the rest of your day

pgVolvra is an open-source SQL tool for undoing accidental changes in PostgreSQL without restoring a backup and manually reconciling rows. It records changes to selected tables, lets users inspect history and preview an undo, and can reconstruct a table’s past state without modifying live data. Undo can target a time window, transaction, database role, application identity, named mark, or selected rows across tables. The central safety feature is conflict detection: if a row has changed since the mistake, the operation stops rather than overwrite newer work. Users can skip conflicting rows, but cannot force an overwrite; row limits also guard against unexpectedly broad operations. An optional warning flags statements that affect unusually many rows.

History can remain in ordinary database tables or be streamed by a companion process to external JSON archives, so it can survive database loss. After restoring a backup, archived changes can be replayed to recover later work; tests report exact recovery after a real database deletion and restore. The tool installs without an extension or superuser privileges and has been verified on Supabase, Neon, and pgEdge Starfleet. Recording history has measurable costs: write throughput falls 11-41%, each change uses about 300-400 bytes, and WAL volume roughly doubles. It requires primary keys and only covers changes made after setup; it is not a backup or full point-in-time recovery system, and replay does not restore schema changes or sequences.

Read on pgedge.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.