diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 6c55f749459..b1f78f6409e 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -106,10 +106,10 @@ pg_dump dbname >
Text files created by pg_dump are intended to
- be read in by the psql program. The
- general command form to restore a dump is
+ be read by the psql program using its default
+ settings. The general command form to restore a text dump is
-psql dbname < dumpfile
+psql -X dbname < dumpfile
where dumpfile is the
file output by the pg_dump command. The database dbname < template0
before executing psql (e.g., with
createdb -T template0 dbname). psql
+ class="parameter">dbname).
+ To ensure psql runs with its default settings,
+ use the () option.
+ psql
supports options similar to pg_dump for specifying
the database server to connect to and the user name to use. See
the reference page for more information.
- Non-text file dumps are restored using the
+
+
+ Non-text file dumps should be restored using the utility.
@@ -141,7 +147,7 @@ psql dbname < psql exit with an
exit status of 3 if an SQL error occurs:
-psql --set ON_ERROR_STOP=on dbname < dumpfile
+psql -X --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
@@ -160,7 +166,7 @@ psql --set ON_ERROR_STOP=on dbname <
write to or read from pipes makes it possible to dump a database
directly from one server to another, for example:
-pg_dump -h host1dbname | psql -h host2dbname
+pg_dump -h host1dbname | psql -X -h host2dbname
@@ -205,7 +211,7 @@ pg_dumpall > dumpfile
The resulting dump can be restored with psql:
-psql -f dumpfile postgres
+psql -X -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
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 574e35310fd..ef424bf4030 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1410,6 +1410,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
subscriber if the subscription had been originally created with
two_phase = true option.
+
+
+ It is generally recommended to use the
+ () option when restoring a database from a
+ plain-text pg_dump script to ensure a clean
+ restore process and prevent potential conflicts with
+ non-default psql configurations.
+
@@ -1427,7 +1435,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
newdb:
-$psql -d newdb -f db.sql
+$psql -X -d newdb -f db.sql
diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index a1fae395afb..342940e5662 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -786,6 +786,17 @@ PostgreSQL documentation
database creation will fail for databases in non-default
locations.
+
+
+ It is generally recommended to use the
+ () option when restoring a database from a
+ pg_dumpall script to ensure a clean restore
+ process and prevent potential conflicts with non-default
+ psql configurations. Additionally, because
+ the pg_dumpall script may
+ include psql meta-commands, it may be
+ incompatible with clients other than psql.
+
@@ -802,9 +813,9 @@ PostgreSQL documentation
To restore database(s) from this file, you can use:
-$psql -f db.out postgres
+$psql -X -f db.out -d postgres
- It is not important to which database you connect here since the
+ It is not important which database you connect to here since the
script file created by pg_dumpall will
contain the appropriate commands to create and connect to the saved
databases. An exception is that if you specified ,