Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/psql-ref.sgml`
e4ba5b875f41f3bf222935f8c475795cf2080e8b84dca7e60000000100000fb6
 class="parameter">filename</replaceable></literal>. In general,
      both will do what you expect, but using <literal>-f</literal>
      enables some nice features such as error messages with line
      numbers. There is also a slight chance that using this option will
      reduce the start-up overhead. On the other hand, the variant using
      the shell's input redirection is (in theory) guaranteed to yield
      exactly the same output you would have received had you entered
      everything by hand.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-field-separator">
      <term><option>-F <replaceable class="parameter">separator</replaceable></option></term>
      <term><option>--field-separator=<replaceable class="parameter">separator</replaceable></option></term>
      <listitem>
      <para>
      Use <replaceable class="parameter">separator</replaceable> as the
      field separator for unaligned output. This is equivalent to
      <command>\pset fieldsep</command> or <command>\f</command>.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-field-host">
      <term><option>-h <replaceable class="parameter">hostname</replaceable></option></term>
      <term><option>--host=<replaceable class="parameter">hostname</replaceable></option></term>
      <listitem>
      <para>
      Specifies the host name of the machine on which the
      server is running. If the value begins
      with a slash, it is used as the directory for the Unix-domain
      socket.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-html">
      <term><option>-H</option></term>
      <term><option>--html</option></term>
      <listitem>
      <para>
      Switches to <acronym>HTML</acronym> output mode.  This is
      equivalent to <command>\pset format html</command> or the
      <command>\H</command> command.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-list">
      <term><option>-l</option></term>
      <term><option>--list</option></term>
      <listitem>
      <para>
      List all available databases, then exit. Other non-connection
      options are ignored. This is similar to the meta-command
      <command>\list</command>.
      </para>

      <para>
      When this option is used, <application>psql</application> will connect
      to the database <literal>postgres</literal>, unless a different database
      is named on the command line (option <option>-d</option> or non-option
      argument, possibly via a service entry, but not via an environment
      variable).
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-log-file">
      <term><option>-L <replaceable class="parameter">filename</replaceable></option></term>
      <term><option>--log-file=<replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
      <para>
       Write all query output into file <replaceable
       class="parameter">filename</replaceable>, in addition to the
       normal output destination.
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-no-readline">
      <term><option>-n</option></term>
      <term><option>--no-readline</option></term>
      <listitem>
      <para>
       Do not use <application>Readline</application> for line editing and
       do not use the command history (see
       <xref linkend="app-psql-readline"/> below).
      </para>
      </listitem>
    </varlistentry>

    <varlistentry id="app-psql-option-output">
      <term><option>-o <replaceable class="parameter">filename</replaceable></option></term>
      <term><option>--output=<replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
      <para>
      Put all query output into file <replaceable
      class="parameter">filename</replaceable>. This is equivalent to
      the command <command>\o</command>.

Title: psql Options: -F, -h, -H, -l, -L, -n, -o
Summary
This section details more command-line options for psql: - `-F` (or `--field-separator`): Sets the field separator for unaligned output. Equivalent to `\pset fieldsep` or `\f`. - `-h` (or `--host`): Specifies the hostname of the server. If the value begins with a slash, it's used as the directory for the Unix-domain socket. - `-H` (or `--html`): Switches to HTML output mode. Equivalent to `\pset format html` or the `\H` command. - `-l` (or `--list`): Lists all available databases and exits. Other non-connection options are ignored. Connects to the `postgres` database unless another database is specified. - `-L` (or `--log-file`): Writes all query output to the specified file in addition to the normal output destination. - `-n` (or `--no-readline`): Disables Readline for line editing and command history. - `-o` (or `--output`): Puts all query output into the specified file. Equivalent to the `\o` command.