I have a postgresql database that lost some records. I want to take a pg_dump SQL dump of the database from a few days ago and merge it with the current production database. A lot of the records are going to be duplicates so it can skip the duplicates. What is the best way to do this?
Not knowing what kind of dump you are working with (plain, tar, or custom)...
If you have dblink available then you could restore to a different database and pull the data over to the production box.
A more convoluted solution might be to
You might have to sort the sort the dump files before you do the diff and depending on how big your database is this might not really be practical.
Also be very careful and do this against a backup until you are sure its right.
Otherwise, maybe there are ETL type tools that can do this.