10

I'm trying to take a backup of schema using pg_dump like,

$ pg_dump -U ganapathy -n hotel_management > ganapathy_schema.dump

It create the backup, But I can't restore it using pg_restore. It give error like this,

pg_restore: [archiver] input file does not appear to be a valid archive

Then I try to take the backup with .sql extension like,

$ pg_dump -U ganapathy -n hotel_management > ganapathy_schema.sql

But It also gives the same error.

pg_restore: [archiver] input file does not appear to be a valid archive

After that I try to take a backup by specifying the format like, -Fc in both .dump and .sql extensions. Then I try to restore it. It restored successfully.

So now my doubt is,

What is the differences between the extensions of .dump and .sql in pg_dump in PostgreSQL?

Because both needs to specify the format.

Thanks in advanced...

asked Nov 14, 2016 at 4:49
1

2 Answers 2

15

The file extension means nothing. At all. It's just a part of a file name.

If you want a custom-format dump for use with pg_restore use -Fc as an argument to pg_dump.

pg_dump defaults to generating SQL-format dumps for use with psql.

See the manual for more details.

Andriy M
23.3k6 gold badges60 silver badges104 bronze badges
answered Nov 14, 2016 at 8:14
1

Try this

see your actual names in the Cluster column

pg_lsclusters

restore a DB backup dump with

pg_restore -h HOST -p PORT -U SUPERUSERNAME -C -d postgres DBtoRESTORE.dump

answered Jan 8, 2019 at 23:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.