snippetsqlModerate
Differences between .dump and .sql in pg_dump PostgreSQL
Viewed 0 times
postgresqldumppg_dumpsqldifferencesbetweenand
Problem
I'm trying to take a backup of schema using pg_dump like,
It create the backup, But I can't restore it using
pg_restore: [archiver] input file does not appear to be a valid
archive
Then I try to take the backup with .
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,
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...
$ pg_dump -U ganapathy -n hotel_management > ganapathy_schema.dumpIt 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.sqlBut 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...
Solution
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
See the manual for more details.
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.
Context
StackExchange Database Administrators Q#155165, answer score: 15
Revisions (0)
No revisions yet.