1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add -U and -W options to pg_dump and friends to support non-interactive

specification of username (like in psql).  pg_dumpall now works with
password authentication.
This commit is contained in:
Peter Eisentraut
2001-05-17 21:12:49 +00:00
parent 761a0bb69b
commit f000ffd28e
11 changed files with 269 additions and 153 deletions

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.7 2001/03/19 16:19:26 petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.8 2001/05/17 21:12:48 petere Exp $ -->
<chapter id="backup">
<title>Backup and Restore</title>
@ -61,11 +61,10 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
As any other <productname>Postgres</> client application,
<application>pg_dump</> will by default connect with the database
user name that is equal to the current Unix user name. To override
this, either specify the <option>-u</option> option to force a prompt for
the user name, or set the environment variable
<envar>PGUSER</envar>. Remember that <application>pg_dump</>
connections are subject to the normal client authentication
mechanisms (which are described in <xref
this, either specify the <option>-U</option> option or set the
environment variable <envar>PGUSER</envar>. Remember that
<application>pg_dump</> connections are subject to the normal
client authentication mechanisms (which are described in <xref
linkend="client-authentication">).
</para>
@ -163,20 +162,6 @@ pg_dumpall &gt; <replaceable>outfile</>
you have database superuser access, as that is required to restore
the user and group information.
</para>
<para>
<application>pg_dumpall</application> has one little flaw: It is
not prepared for interactively authenticating to each database it
dumps. If you are using password authentication then you need to
set it the environment variable <envar>PGPASSWORD</envar> to
communicate the password the the underlying calls to
<application>pg_dump</>. More severely, if you have different
passwords set up for each database, then
<application>pg_dumpall</> will fail. You can either choose a
different authentication mechanism for the purposes of backup or
adjust the <filename>pg_dumpall</filename> shell script to your
needs.
</para>
</sect2>
<sect2 id="backup-dump-large">

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.31 2001/03/17 16:27:31 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.32 2001/05/17 21:12:48 petere Exp $
Postgres documentation
-->
@ -46,7 +46,8 @@ Postgres documentation
<arg>-Z <replaceable>0...9</replaceable></arg>
<arg>-h <replaceable>host</replaceable></arg>
<arg>-p <replaceable>port</replaceable></arg>
<arg>-u</arg>
<arg>-U <replaceable>username</replaceable></arg>
<arg>-W</arg>
<arg choice="plain"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
@ -412,13 +413,20 @@ Postgres documentation
</varlistentry>
<varlistentry>
<term>-u</term>
<term>-U <replaceable>username</replaceable></term>
<listitem>
<para>
Use password authentication.
Prompts for
<replaceable class="parameter">username</replaceable>
and <replaceable class="parameter">password</replaceable>.
Connect as the given user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-W</term>
<listitem>
<para>
Force a password prompt. This should happen automatically if
the server requires password authentication.
</para>
</listitem>
</varlistentry>

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.21 2001/03/05 18:42:57 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.22 2001/05/17 21:12:48 petere Exp $
Postgres documentation
-->
@ -23,9 +23,11 @@ Postgres documentation
<cmdsynopsis>
<command>pg_dumpall</command>
<group><arg>-c</arg><arg>--clean</arg></group>
<group><arg>-g</arg><arg>--globals-only</arg></group>
<arg>-h <replaceable>host</replaceable></arg>
<arg>-p <replaceable>port</replaceable></arg>
<group><arg>-g</arg><arg>--globals-only</arg></group>
<arg>-U <replaceable>username</replaceable></arg>
<arg>-W</arg>
</cmdsynopsis>
</refsynopsisdiv>
@ -81,6 +83,15 @@ Postgres documentation
</listitem>
</varlistentry>
<varlistentry>
<term>-g, --globals-only</term>
<listitem>
<para>
Only dump global objects (users and groups), no databases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h <replaceable>host</replaceable></term>
<listitem>
@ -106,14 +117,23 @@ Postgres documentation
</varlistentry>
<varlistentry>
<term>-g, --globals-only</term>
<term>-U <replaceable>username</replaceable></term>
<listitem>
<para>
Only dump global objects (users and groups), no databases.
Connect as the given user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-W</term>
<listitem>
<para>
Force a password prompt. This should happen automatically if
the server requires password authentication.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
@ -128,8 +148,8 @@ Postgres documentation
</refsect2>
</refsect1>
<refsect1 id="app-pg-dumpall-usage">
<title>Usage</title>
<refsect1 id="app-pg-dumpall-ex">
<title>Examples</title>
<para>
To dump all databases:

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.10 2001/03/17 16:27:31 petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.11 2001/05/17 21:12:48 petere Exp $ -->
<refentry id="APP-PGRESTORE">
<docinfo>
@ -46,7 +46,8 @@
<arg> -x </arg>
<arg> -h <replaceable class="parameter">host</replaceable> </arg>
<arg> -p <replaceable class="parameter">port</replaceable> </arg>
<arg> -u </arg>
<arg> -U <replaceable>username</replaceable> </arg>
<arg> -W </arg>
<arg> <replaceable class="parameter">archive-file</replaceable> </arg>
</cmdsynopsis>
</refsynopsisdiv>
@ -448,10 +449,20 @@
</varlistentry>
<varlistentry>
<term>-u</term>
<term>-U <replaceable>username</replaceable></term>
<listitem>
<para>
Use password authentication. Prompts for user name and password.
Connect as the given user.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-W</term>
<listitem>
<para>
Force a password prompt. This should happen automatically if
the server requires password authentication.
</para>
</listitem>
</varlistentry>