class="parameter">dbname will not be created by this
command, so you must create it yourself from template0
behavior and have
psql exit with an
exit status of 3 if an SQL error occurs:
-psql --set ON_ERROR_STOP=on dbname < infile
+psql --set ON_ERROR_STOP=on dbname < dumpfile
Either way, you will only have a partially restored database.
Alternatively, you can specify that the whole dump should be
cluster, and also preserves cluster-wide data such as role and
tablespace definitions. The basic usage of this command is:
-pg_dumpall > outfile
+pg_dumpall > dumpfile
The resulting dump can be restored with
psql:
-psql -f infile postgres
+psql -f dumpfile postgres
(Actually, you can specify any existing database name to start from,
but if you are loading into an empty cluster then postgres