1

Is it possible to access, particularly insert into, a database while it's being restored by pg_restore from a custom format. If yes, then should I care about preventing clients from accessing the database while pg_restore is running, or the restore operation is "transactional" so that after it ends all changes made by clients since its start will be lost?

1 Answer 1

1

If you want to keep concurrent sessions out of your database during pg_restore, you'll have to block them with a pg_hba.conf entry.

There is no protection from concurrent sessions inserting or otherwise modifying data while pg_restore is running.

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

2 Comments

Plus you might run into problems, like if a client inserted something into an empty table, used a sequence value, and the restore wants to insert the very same value as well. The current sequence values (as of the time of the backup) are restored near the end of the restore process.
@A.Scherbaum, yes, that's the issue I ran into. So the right way to restore a database is to prevent clients from accessing it until the restore completes.

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.