2

Of course, the situation is such that I need a solution as soon as possible.

I have database in production in which I accidentally ran a script that deleted records that I did not want deleted. Thankfully, I have a backup of the data before doing so as an *.sql file. As such, I can manipulate it on my development environment to obtain only the data or even a dump file from pg_dump.

Whenever I try to use pg_restore or psql to import the file, it does not seem to import the missing rows. It throws many errors, which I expect since it has duplicate data. But I don't care about the duplicate data; I want the non-duplicated data back into the database.

Does anyone have any idea how to about doing this?

1 Answer 1

2

pg_dump with --inserts. This will get you a script with individual inserts for the rows instead of single COPY statements.

Run the script with AUTOCOMMIT on (the default).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.