mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Doc: recommend "psql -X" for restoring pg_dump scripts.
This practice avoids possible problems caused by non-default psql options, such as disabling AUTOCOMMIT. Author: Shinya Kato <Shinya11.Kato@oss.nttdata.com> Reviewed-by: Robert Treat <rob@xzilla.net> Discussion: https://postgr.es/m/96ff23a5d858ff72ca8e823a014d16fe@oss.nttdata.com Backpatch-through: 13
This commit is contained in:
@@ -1636,6 +1636,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
option will be automatically enabled by the subscriber if the subscription
|
||||
had been originally created with <literal>two_phase = true</literal> option.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is generally recommended to use the <option>-X</option>
|
||||
(<option>--no-psqlrc</option>) option when restoring a database from a
|
||||
plain-text <application>pg_dump</application> script to ensure a clean
|
||||
restore process and prevent potential conflicts with
|
||||
non-default <application>psql</application> configurations.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="pg-dump-examples" xreflabel="Examples">
|
||||
@@ -1653,7 +1661,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
<literal>newdb</literal>:
|
||||
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>psql -d newdb -f db.sql</userinput>
|
||||
<prompt>$</prompt> <userinput>psql -X -d newdb -f db.sql</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
|
@@ -817,6 +817,17 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
|
||||
database creation will fail for databases in non-default
|
||||
locations.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is generally recommended to use the <option>-X</option>
|
||||
(<option>--no-psqlrc</option>) option when restoring a database from a
|
||||
<application>pg_dumpall</application> script to ensure a clean restore
|
||||
process and prevent potential conflicts with non-default
|
||||
<application>psql</application> configurations. Additionally, because
|
||||
the <application>pg_dumpall</application> script may
|
||||
include <application>psql</application> meta-commands, it may be
|
||||
incompatible with clients other than <application>psql</application>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -833,9 +844,9 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
|
||||
<para>
|
||||
To restore database(s) from this file, you can use:
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>psql -f db.out postgres</userinput>
|
||||
<prompt>$</prompt> <userinput>psql -X -f db.out -d postgres</userinput>
|
||||
</screen>
|
||||
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 <application>pg_dumpall</application> will
|
||||
contain the appropriate commands to create and connect to the saved
|
||||
databases. An exception is that if you specified <option>--clean</option>,
|
||||
|
Reference in New Issue
Block a user