Nakx
Nakx

Reputation: 1600

How to restore database from .pg_dump file using pgAdmin

I was given a mydb.pg_dump file. I have created a new database test1 with pgAdmin. When I click right on the database and select Restore..., I can select my file after selecting "All files". But when I attempt to restore the database I immediately obtain this error:

pg_restore: error: input file appears to be a text format dump. Please use psql.

Can I use pgAdmin to restore a .pg_dump file? How?

Upvotes: 0

Views: 7896

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247790

You cannot use pgAdmin for that, because in a plain-text dump COPY statements are mixed with COPY data.

You need psql for that, which fortunately is already installed on your machine:

psql -d mydb -U postgres -f mydb.pg_dump

Upvotes: 3

Related Questions