Home Explore Blog CI



postgresql

63th chunk of `doc/src/sgml/ref/psql-ref.sgml`
b3e2f51b4704a67155207c87251227b77982d6b96099748e0000000100000fc4
 are:
   </para>

    <variablelist>
      <varlistentry id="app-psql-variables-autocommit">
      <term>
       <varname>AUTOCOMMIT</varname>
       <indexterm>
        <primary>autocommit</primary>
        <secondary>psql</secondary>
       </indexterm>
      </term>
        <listitem>
        <para>
        When <literal>on</literal> (the default), each SQL command is automatically
        committed upon successful completion.  To postpone commit in this
        mode, you must enter a <command>BEGIN</command> or <command>START
        TRANSACTION</command> SQL command.  When <literal>off</literal> or unset, SQL
        commands are not committed until you explicitly issue
        <command>COMMIT</command> or <command>END</command>.  The autocommit-off
        mode works by issuing an implicit <command>BEGIN</command> for you, just
        before any command that is not already in a transaction block and
        is not itself a <command>BEGIN</command> or other transaction-control
        command, nor a command that cannot be executed inside a transaction
        block (such as <command>VACUUM</command>).
        </para>

        <note>
        <para>
         In autocommit-off mode, you must explicitly abandon any failed
         transaction by entering <command>ABORT</command> or <command>ROLLBACK</command>.
         Also keep in mind that if you exit the session
         without committing, your work will be lost.
        </para>
        </note>

        <note>
        <para>
         The autocommit-on mode is <productname>PostgreSQL</productname>'s traditional
         behavior, but autocommit-off is closer to the SQL spec.  If you
         prefer autocommit-off, you might wish to set it in the system-wide
         <filename>psqlrc</filename> file or your
         <filename>~/.psqlrc</filename> file.
        </para>
        </note>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-comp-keyword-case">
        <term><varname>COMP_KEYWORD_CASE</varname></term>
        <listitem>
        <para>
        Determines which letter case to use when completing an SQL key word.
        If set to <literal>lower</literal> or <literal>upper</literal>, the
        completed word will be in lower or upper case, respectively.  If set
        to <literal>preserve-lower</literal>
        or <literal>preserve-upper</literal> (the default), the completed word
        will be in the case of the word already entered, but words being
        completed without anything entered will be in lower or upper case,
        respectively.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-dbname">
        <term><varname>DBNAME</varname></term>
        <listitem>
        <para>
        The name of the database you are currently connected to. This is
        set every time you connect to a database (including program
        start-up), but can be changed or unset.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-echo">
        <term><varname>ECHO</varname></term>
        <listitem>
        <para>
        If set to <literal>all</literal>, all nonempty input lines are printed
        to standard output as they are read.  (This does not apply to lines
        read interactively.)  To select this behavior on program
        start-up, use the switch <option>-a</option>. If set to
        <literal>queries</literal>,
        <application>psql</application> prints each query to standard output
        as it is sent to the server. The switch to select this behavior is
        <option>-e</option>. If set to <literal>errors</literal>, then only
        failed queries are displayed on standard error output. The switch
        for this behavior is <option>-b</option>. If set to
        <literal>none</literal> (the default), then no queries are displayed.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-variables-echo-hidden">

Title: psql Special Variables: AUTOCOMMIT, COMP_KEYWORD_CASE, DBNAME, ECHO
Summary
This section details several specially treated variables in psql, including AUTOCOMMIT, which controls automatic committing of SQL commands; COMP_KEYWORD_CASE, which determines the letter case of SQL keywords during tab completion; DBNAME, which stores the name of the currently connected database; and ECHO, which controls the printing of input lines and queries to standard output.