mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Improve consistency of parsing of psql's magic variables.
For simple boolean variables such as ON_ERROR_STOP, psql has for a long time recognized variant spellings of "on" and "off" (such as "1"/"0"), and it also made a point of warning you if you'd misspelled the setting. But these conveniences did not exist for other keyword-valued variables. In particular, though ECHO_HIDDEN and ON_ERROR_ROLLBACK include "on" and "off" as possible values, none of the alternative spellings for those were recognized; and to make matters worse the code would just silently assume "on" was meant for any unrecognized spelling. Several people have reported getting bitten by this, so let's fix it. In detail, this patch: * Allows all spellings recognized by ParseVariableBool() for ECHO_HIDDEN and ON_ERROR_ROLLBACK. * Reports a warning for unrecognized values for COMP_KEYWORD_CASE, ECHO, ECHO_HIDDEN, HISTCONTROL, ON_ERROR_ROLLBACK, and VERBOSITY. * Recognizes all values for all these variables case-insensitively; previously there was a mishmash of case-sensitive and case-insensitive behaviors. Back-patch to all supported branches. There is a small risk of breaking existing scripts that were accidentally failing to malfunction; but the consensus is that the chance of detecting real problems and preventing future mistakes outweighs this.
This commit is contained in:
@ -157,8 +157,7 @@ EOF
|
||||
Echo the actual queries generated by <command>\d</command> and other backslash
|
||||
commands. You can use this to study <application>psql</application>'s
|
||||
internal operations. This is equivalent to
|
||||
setting the variable <varname>ECHO_HIDDEN</varname> from within
|
||||
<application>psql</application>.
|
||||
setting the variable <varname>ECHO_HIDDEN</varname> to <literal>on</>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -317,8 +316,8 @@ EOF
|
||||
quietly. By default, it prints welcome messages and various
|
||||
informational output. If this option is used, none of this
|
||||
happens. This is useful with the <option>-c</option> option.
|
||||
Within <application>psql</application> you can also set the
|
||||
<varname>QUIET</varname> variable to achieve the same effect.
|
||||
This is equivalent to setting the variable <varname>QUIET</varname>
|
||||
to <literal>on</>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -2582,8 +2581,9 @@ bar
|
||||
<term><varname>ECHO_HIDDEN</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When this variable is set and a backslash command queries the
|
||||
database, the query is first shown. This way you can study the
|
||||
When this variable is set to <literal>on</> and a backslash command
|
||||
queries the database, the query is first shown.
|
||||
This feature helps you to study
|
||||
<productname>PostgreSQL</productname> internals and provide
|
||||
similar functionality in your own programs. (To select this behavior
|
||||
on program start-up, use the switch <option>-E</option>.) If you set
|
||||
@ -2741,16 +2741,16 @@ bar
|
||||
<term><varname>ON_ERROR_ROLLBACK</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
When <literal>on</>, if a statement in a transaction block
|
||||
When set to <literal>on</>, if a statement in a transaction block
|
||||
generates an error, the error is ignored and the transaction
|
||||
continues. When <literal>interactive</>, such errors are only
|
||||
continues. When set to <literal>interactive</>, such errors are only
|
||||
ignored in interactive sessions, and not when reading script
|
||||
files. When <literal>off</> (the default), a statement in a
|
||||
files. When unset or set to <literal>off</>, a statement in a
|
||||
transaction block that generates an error aborts the entire
|
||||
transaction. The on_error_rollback-on mode works by issuing an
|
||||
transaction. The error rollback mode works by issuing an
|
||||
implicit <command>SAVEPOINT</> for you, just before each command
|
||||
that is in a transaction block, and rolls back to the savepoint
|
||||
on error.
|
||||
that is in a transaction block, and then rolling back to the
|
||||
savepoint if the command fails.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -2760,7 +2760,8 @@ bar
|
||||
<listitem>
|
||||
<para>
|
||||
By default, command processing continues after an error. When this
|
||||
variable is set, it will instead stop immediately. In interactive mode,
|
||||
variable is set to <literal>on</>, processing will instead stop
|
||||
immediately. In interactive mode,
|
||||
<application>psql</application> will return to the command prompt;
|
||||
otherwise, <application>psql</application> will exit, returning
|
||||
error code 3 to distinguish this case from fatal error
|
||||
@ -2802,8 +2803,8 @@ bar
|
||||
<term><varname>QUIET</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This variable is equivalent to the command line option
|
||||
<option>-q</option>. It is probably not too useful in
|
||||
Setting this variable to <literal>on</> is equivalent to the command
|
||||
line option <option>-q</option>. It is probably not too useful in
|
||||
interactive mode.
|
||||
</para>
|
||||
</listitem>
|
||||
@ -2813,8 +2814,8 @@ bar
|
||||
<term><varname>SINGLELINE</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This variable is equivalent to the command line option
|
||||
<option>-S</option>.
|
||||
Setting this variable to <literal>on</> is equivalent to the command
|
||||
line option <option>-S</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -2823,8 +2824,8 @@ bar
|
||||
<term><varname>SINGLESTEP</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This variable is equivalent to the command line option
|
||||
<option>-s</option>.
|
||||
Setting this variable to <literal>on</> is equivalent to the command
|
||||
line option <option>-s</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
Reference in New Issue
Block a user