psql --version
psql (PostgreSQL) 9.3.5
I am trying to restore only the schema. I have tried the following command:
pg_restore -s -d rh /path/to/dump.sql
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
I have tried looking in the documentation of psql and have not found a schema-only flag.
If you know of any other technique to acheieve this I would be very appreciative.
If it helps I am using OSX Version 10.10
You can generate a text dumpfile using -s to generate only schema dump like this :
pg_dump -s <database name> > pg_dump_text_filename
You should use psql command to connect to your database :
psql -U <username> -d <databasename>
and then at the psql prompt use this :
\i <pg_dump_text_file_path>
You can also use the archive file format of pg_dump :
pg_dump -Fc -f <archive file> <database name>
And then pg_restore only the schema :
pg_restore -d <database name> -s <archive file>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With