]> granicus.if.org Git - postgresql/commit
Improve consistency of parsing of psql's magic variables.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Dec 2014 17:17:04 +0000 (12:17 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 31 Dec 2014 17:17:04 +0000 (12:17 -0500)
commit64c506535d6f8c719a126057b3b0796178c59915
tree3ceaf817ba2d77336e78a72cb59857d03006dadb
parent4db7eaae0f1aca8503f8a638a2775c1a3e0a17bb
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.
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
src/bin/psql/settings.h
src/bin/psql/startup.c
src/bin/psql/tab-complete.c
src/bin/psql/variables.c
src/bin/psql/variables.h