Home Explore Blog CI



postgresql

76th chunk of `doc/src/sgml/ref/psql-ref.sgml`
06dd873dbfe5c6d77297ba1a4ac6ff0307f0a0750637260c0000000100000fa3
 some contexts this can interfere
    with other operations.  For example, after <command>BEGIN</command>
    it will be too late to issue <command>SET TRANSACTION ISOLATION
    LEVEL</command> if a tab-completion query is issued in between.
    If you do not want tab completion at all, you
    can turn it off permanently by putting this in a file named
    <filename>.inputrc</filename> in your home directory:
<programlisting>
$if psql
set disable-completion on
$endif
</programlisting>
    (This is not a <application>psql</application> but a
    <application>Readline</application> feature. Read its documentation
    for further details.)
    </para>

    <para>
     The <option>-n</option> (<option>--no-readline</option>) command line
     option can also be useful to disable use
     of <application>Readline</application> for a single run
     of <application>psql</application>.  This prevents tab completion,
     use or recording of command line history, and editing of multi-line
     commands.  It is particularly useful when you need to copy-and-paste
     text that contains <literal>TAB</literal> characters.
    </para>
   </refsect3>
  </refsect2>
 </refsect1>


 <refsect1 id="app-psql-environment" xreflabel="Environment">
  <title>Environment</title>

  <variablelist>

   <varlistentry id="app-psql-environment-columns">
    <term><envar>COLUMNS</envar></term>

    <listitem>
     <para>
      If <literal>\pset columns</literal> is zero, controls the
      width for the <literal>wrapped</literal> format and width for determining
      if wide output requires the pager or should be switched to the
      vertical format in expanded auto mode.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="app-psql-environment-pgdatabase">
    <term><envar>PGDATABASE</envar></term>
    <term><envar>PGHOST</envar></term>
    <term><envar>PGPORT</envar></term>
    <term><envar>PGUSER</envar></term>

    <listitem>
     <para>
      Default connection parameters (see <xref linkend="libpq-envars"/>).
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="app-psql-environment-pg-color">
    <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>

   <varlistentry id="app-psql-environment-psql-editor">
    <term><envar>PSQL_EDITOR</envar></term>
    <term><envar>EDITOR</envar></term>
    <term><envar>VISUAL</envar></term>

    <listitem>
     <para>
      Editor used by the <command>\e</command>, <command>\ef</command>,
      and <command>\ev</command> commands.
      These variables are examined in the order listed;
      the first that is set is used.
      If none of them is set, the default is to use <filename>vi</filename>
      on Unix systems or <filename>notepad.exe</filename> on Windows systems.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="app-psql-environment-psql-editor-linenumber-arg">
    <term><envar>PSQL_EDITOR_LINENUMBER_ARG</envar></term>

    <listitem>
     <para>
      When <command>\e</command>, <command>\ef</command>, or
      <command>\ev</command> is used
      with a line number argument, this variable specifies the
      command-line argument used to pass the starting line number to
      the user's editor.  For editors such as <productname>Emacs</productname> or
      <productname>vi</productname>, this is a plus sign.  Include a trailing
      space in the value of the variable if there needs to be space
      between the option name and the line number.  Examples:
<programlisting>
PSQL_EDITOR_LINENUMBER_ARG='+'
PSQL_EDITOR_LINENUMBER_ARG='--line '
</programlisting>
     </para>

     <para>
      The default is <literal>+</literal> on Unix systems
      (corresponding to the default editor <filename>vi</filename>,
      and useful for

Title: Disabling Readline in psql and Environment Variables
Summary
This section explains how to disable tab completion in psql using the .inputrc file or the -n command-line option. It also details various environment variables that affect psql's behavior, including connection parameters (PGDATABASE, PGHOST, PGPORT, PGUSER), color in diagnostic messages (PG_COLOR), and the editor used by the \e, \ef, and \ev commands (PSQL_EDITOR, EDITOR, VISUAL), along with specifying the line number argument (PSQL_EDITOR_LINENUMBER_ARG) for the editor.