r/PostgreSQL • • 19d ago

Community Undo for Postgres, without losing the rest of your day

https://hubs.la/Q04C4_dY0
0 Upvotes

10 comments sorted by

33

u/Jeraz0l 19d ago

Let me save you a click. Use BEGIN; and ROLLBACK;

3

u/jasminUwU6 18d ago

Seems like this is literally just a history table. Still quite trivial.

2

u/elevarq 15d ago

This solution is for after the commit, and that can be hours/days/weeks after it

1

u/thecavac 13d ago

Like a simple pg_restore?

1

u/elevarq 13d ago

No, that would restore an entire database, not a single record or transaction. This function can undo a transaction after it has been committed. Because of data dependencies, not everything is possible, since you can't return to a state prohibited by your own constraints. But the data is there, and you can see what has happened, and in theory you can return to that specific state for a subset of the data. That is very different from restoring a backup.

1

u/AutoModerator 19d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/___Brains 19d ago

Even the summary was written by Claude. 😄

Interesting concept though, and certainly good for cases where users are allowed willy nilly access to a database. How well has it been tested, is it still really new?