Home Explore Blog CI



postgresql

11th chunk of `doc/src/sgml/ref/pg_dumpall.sgml`
2f4e5aaa89edeb228e17e2cf6e08e6b38a2420feeaf4795a0000000100000deb
 the server requires
        password authentication and a password is not available by
        other means such as a <filename>.pgpass</filename> file, the
        connection attempt will fail.  This option can be useful in
        batch jobs and scripts where no user is present to enter a
        password.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-W</option></term>
      <term><option>--password</option></term>
      <listitem>
       <para>
        Force <application>pg_dumpall</application> to prompt for a
        password before connecting to a database.
       </para>

       <para>
        This option is never essential, since
        <application>pg_dumpall</application> will automatically prompt
        for a password if the server demands password authentication.
        However, <application>pg_dumpall</application> will waste a
        connection attempt finding out that the server wants a password.
        In some cases it is worth typing <option>-W</option> to avoid the extra
        connection attempt.
       </para>

       <para>
        Note that the password prompt will occur again for each database
        to be dumped.  Usually, it's better to set up a
        <filename>~/.pgpass</filename> file than to rely on manual password entry.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--role=<replaceable class="parameter">rolename</replaceable></option></term>
      <listitem>
       <para>
        Specifies a role name to be used to create the dump.
        This option causes <application>pg_dumpall</application> to issue a
        <command>SET ROLE</command> <replaceable class="parameter">rolename</replaceable>
        command after connecting to the database. It is useful when the
        authenticated user (specified by <option>-U</option>) lacks privileges
        needed by <application>pg_dumpall</application>, but can switch to a role with
        the required rights.  Some installations have a policy against
        logging in directly as a superuser, and use of this option allows
        dumps to be made without violating the policy.
       </para>
      </listitem>
     </varlistentry>
   </variablelist>
  </para>
 </refsect1>


 <refsect1>
  <title>Environment</title>

  <variablelist>
   <varlistentry>
    <term><envar>PGHOST</envar></term>
    <term><envar>PGOPTIONS</envar></term>
    <term><envar>PGPORT</envar></term>
    <term><envar>PGUSER</envar></term>

    <listitem>
     <para>
      Default connection parameters
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><envar>PG_COLOR</envar></term>
    <listitem>
     <para>
      Specifies whether to use color in diagnostic messages. Possible values
      are <literal>always</literal>, <literal>auto</literal> and
      <literal>never</literal>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>

  <para>
   This utility, like most other <productname>PostgreSQL</productname> utilities,
   also uses the environment variables supported by <application>libpq</application>
   (see <xref linkend="libpq-envars"/>).
  </para>

 </refsect1>


 <refsect1>
  <title>Notes</title>

  <para>
   Since <application>pg_dumpall</application> calls
   <application>pg_dump</application> internally, some diagnostic
   messages will refer to <application>pg_dump</application>.
  </para>

  <para>
   The <option>--clean</option> option can be useful even when your
   intention is to restore the dump

Title: pg_dumpall: Password Options, Role Specification, and Environment Variables
Summary
This section details the password options for pg_dumpall, including forcing a password prompt and avoiding password prompts. It also covers how to specify a role for creating the dump and describes the environment variables used for default connection parameters and color in diagnostic messages, similar to other PostgreSQL utilities and libpq.