@@ -106,22 +106,28 @@ pg_dump <replaceable class="parameter">dbname</replaceable> > <replaceable cl
106
106
107
107
<para>
108
108
Text files created by <application>pg_dump</application> are intended to
109
- be read in by the <application>psql</application> program. The
110
- general command form to restore a dump is
109
+ be read by the <application>psql</application> program using its default
110
+ settings. The general command form to restore a text dump is
111
111
<synopsis>
112
- psql <replaceable class="parameter">dbname</replaceable> < <replaceable class="parameter">dumpfile</replaceable>
112
+ psql -X <replaceable class="parameter">dbname</replaceable> < <replaceable class="parameter">dumpfile</replaceable>
113
113
</synopsis>
114
114
where <replaceable class="parameter">dumpfile</replaceable> is the
115
115
file output by the <application>pg_dump</application> command. The database <replaceable
116
116
class="parameter">dbname</replaceable> will not be created by this
117
117
command, so you must create it yourself from <literal>template0</literal>
118
118
before executing <application>psql</application> (e.g., with
119
119
<literal>createdb -T template0 <replaceable
120
- class="parameter">dbname</replaceable></literal>). <application>psql</application>
120
+ class="parameter">dbname</replaceable></literal>).
121
+ To ensure <application>psql</application> runs with its default settings,
122
+ use the <option>-X</option> (<option>--no-psqlrc</option>) option.
123
+ <application>psql</application>
121
124
supports options similar to <application>pg_dump</application> for specifying
122
125
the database server to connect to and the user name to use. See
123
126
the <xref linkend="app-psql"/> reference page for more information.
124
- Non-text file dumps are restored using the <xref
127
+ </para>
128
+
129
+ <para>
130
+ Non-text file dumps should be restored using the <xref
125
131
linkend="app-pgrestore"/> utility.
126
132
</para>
127
133
@@ -141,7 +147,7 @@ psql <replaceable class="parameter">dbname</replaceable> < <replaceable class
141
147
behavior and have <application>psql</application> exit with an
142
148
exit status of 3 if an SQL error occurs:
143
149
<programlisting>
144
- psql --set ON_ERROR_STOP=on <replaceable>dbname</replaceable> < <replaceable>dumpfile</replaceable>
150
+ psql -X - -set ON_ERROR_STOP=on <replaceable>dbname</replaceable> < <replaceable>dumpfile</replaceable>
145
151
</programlisting>
146
152
Either way, you will only have a partially restored database.
147
153
Alternatively, you can specify that the whole dump should be
@@ -160,7 +166,7 @@ psql --set ON_ERROR_STOP=on <replaceable>dbname</replaceable> < <replaceable>
160
166
write to or read from pipes makes it possible to dump a database
161
167
directly from one server to another, for example:
162
168
<programlisting>
163
- pg_dump -h <replaceable>host1</replaceable> <replaceable>dbname</replaceable> | psql -h <replaceable>host2</replaceable> <replaceable>dbname</replaceable>
169
+ pg_dump -h <replaceable>host1</replaceable> <replaceable>dbname</replaceable> | psql -X - h <replaceable>host2</replaceable> <replaceable>dbname</replaceable>
164
170
</programlisting>
165
171
</para>
166
172
@@ -205,7 +211,7 @@ pg_dumpall > <replaceable>dumpfile</replaceable>
205
211
</synopsis>
206
212
The resulting dump can be restored with <application>psql</application>:
207
213
<synopsis>
208
- psql -f <replaceable class="parameter">dumpfile</replaceable> postgres
214
+ psql -X - f <replaceable class="parameter">dumpfile</replaceable> postgres
209
215
</synopsis>
210
216
(Actually, you can specify any existing database name to start from,
211
217
but if you are loading into an empty cluster then <literal>postgres</literal>
0 commit comments