Tuesday, April 1, 2014
PostgreSQL trash can
The PostgreSQL trash can is a PostgreSQL plugin that implements a trash can/wastebasket/rubbish bin/recycling container. You drop a table and it's not really gone but only moved to the trash. This allows desktop-minded users to drop tables willy-nilly while giving them the warm and fuzzy feeling of knowing that their data is still there (while giving administrators the cold and, uh, unfuzzy feeling of knowing that disk space will never really be freed again). Now they only need to think of "vacuum" as "disk defragmentation", and they'll feel right at home.
Labels:
Computing,
English,
PostgreSQL
Subscribe to:
Post Comments (Atom)
Can we achieve the same goal using the DDL triggers?
ReplyDeleteNo, event triggers cannot change a command into a different one.
DeleteGreat extension. Does it work for anything besides tables. I have a bunch of functions and whole schemas I want to trash, but I want to be able to pull them from trash just in case.
ReplyDeletesmall matter of programming :-)
Delete+1 for allowing all objects, including schemas.
ReplyDeleteGreat work though in any case!
BTW, the other thing that you'd want from this is to know when something was actually deleted so you can better manage what you empty from the trash and when (and in this case I'm in favor of not being forced to empty the entire can at once).
DeleteWe've actually implemented something similar to this with a to_delete schema, but the big thing we're missing is knowing when something was deleted (as well as the schema it originally lived in, but that hasn't been much of an issue in reality).
Great addition. How can this be installed under Windows? Are all, windows users are probably going to be the ones wanting to use this the most.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteAh, bringing the great file deletion vs editing confusion to PostgreSQL ;-)
ReplyDeleteDelete a file: oh, you can undo that.
Delete the *contents of* a file and save it: Gone forever.
Personally I think the Trash box is a dangerous half-measure; I've seen many (many) people burned by thinking that since you can recover a deleted file, you can recover deleted *parts of* a file too. It's a pity versioned file systems never took off, they were a much better solution despite the performance and capacity problems.
I can see that this would be handy for some deployments but I'd want to make really sure users understood that 'DELETE FROM mytable;' won't be undo-able.