I accidentally deleted all the records from 3 tables in PostgreSQL. How can i restore the data?
PostgreSQL ROLLBACK command is used to undo the changes done in transactions.
The ROLLBACK command is the transactional command used to undo transactions that have not already been saved to the database. The ROLLBACK command can only be used to undo transactions since the last COMMIT or ROLLBACK command was issued.
pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.
This is a similar problem as discussed here:
Can I rollback a transaction I've already committed? (data loss)
Basically, restore from backup. If you can't, you might be able to recover with pg_dirtyread
.
If you don't have backups, stop the whole server, take a disk image of the drive, and contact a $lots data recovery expert.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With