Mr.G
Mr.G

Reputation: 73

Using pg_restore with a remote file

I'm trying to use pg_restore to restore my database from a remote file stored in an amazon S3 bucket.

I tried to do this : pg_restore -c -d mydb https://myfileURL but it doesn't work, it says there is no such file or directory. The URL is fine, it's just that it can't get the file from it.

Which makes sense somehow but how can I do such a thing then ?

Perhaps there is a way to do something like this : https://myfileURL > dump.tmp and then executing pg_restore with the created file ?

Not sure if it could be a solution but I don't want to use the AWS CLI.

Upvotes: 1

Views: 1090

Answers (2)

user11233617
user11233617

Reputation: 1

If you are using PgAdmin4 I've found that if you copy & paste the script to a new SQL window the actual errors show up.

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 269330

Download the file first:

wget https://myfileURL -O dump.tmp
pg_restore -c -d dump.tmp

Upvotes: 2

Related Questions