Home Explore Blog CI



postgresql

7th chunk of `doc/src/sgml/ref/psql-ref.sgml`
7e8c2e1b50aa330a9d661e96c565cbe75f373fa187ea1bf80000000100000fa4
 class="parameter">assignment</replaceable></option></term>
      <term><option>--set=<replaceable class="parameter">assignment</replaceable></option></term>
      <term><option>--variable=<replaceable class="parameter">assignment</replaceable></option></term>
      <listitem>
      <para>
      Perform a variable assignment, like the <command>\set</command>
      meta-command. Note that you must separate name and value, if
      any, by an equal sign on the command line. To unset a variable,
      leave off the equal sign. To set a variable with an empty value,
      use the equal sign but leave off the value. These assignments are
      done during command line processing, so variables that reflect
      connection state will get overwritten later.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-version">
      <term><option>-V</option></term>
      <term><option>--version</option></term>
      <listitem>
      <para>
      Print the <application>psql</application> version and exit.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-no-password">
     <term><option>-w</option></term>
     <term><option>--no-password</option></term>
     <listitem>
      <para>
       Never issue a password prompt.  If the server requires password
       authentication and a password is not available from other sources
       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>

      <para>
       Note that this option will remain set for the entire session,
       and so it affects uses of the meta-command
       <command>\connect</command> as well as the initial connection attempt.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-password">
      <term><option>-W</option></term>
      <term><option>--password</option></term>
      <listitem>
      <para>
       Force <application>psql</application> to prompt for a
       password before connecting to a database, even if the password will
       not be used.
      </para>

      <para>
       If the server requires password authentication and a password is not
       available from other sources such as a <filename>.pgpass</filename>
       file, <application>psql</application> will prompt for a
       password in any case.  However, <application>psql</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 this option will remain set for the entire session,
       and so it affects uses of the meta-command
       <command>\connect</command> as well as the initial connection attempt.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-expanded">
      <term><option>-x</option></term>
      <term><option>--expanded</option></term>
      <listitem>
      <para>
      Turn on the expanded table formatting mode. This is equivalent to
      <command>\x</command> or <command>\pset expanded</command>.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-no-psqlrc">
      <term><option>-X</option></term>
      <term><option>--no-psqlrc</option></term>
      <listitem>
      <para>
      Do not read the start-up file (neither the system-wide
      <filename>psqlrc</filename> file nor the user's
      <filename>~/.psqlrc</filename> file).
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-field-separator-zero">
      <term><option>-z</option></term>
      <term><option>--field-separator-zero</option></term>
      <listitem>
      <para>
      Set the field separator for unaligned output to a zero byte.  This is
      equivalent

Title: psql Options: -v, -V, -w, -W, -x, -X, -z
Summary
This section details more command-line options for psql: - `-v`: Performs a variable assignment. - `-V`: Prints the psql version and exits. - `-w`: Never issue a password prompt. - `-W`: Forces psql to prompt for a password before connecting. - `-x`: Turns on expanded table formatting mode. - `-X`: Does not read the start-up file (psqlrc). - `-z`: Sets the field separator for unaligned output to a zero byte.