mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Clean up psql's behavior for a few more control variables.
Modify FETCH_COUNT to always have a defined value, like other control variables, mainly so it will always appear in "\set" output. Add hooks to force HISTSIZE to be defined and require it to have an integer value. (I don't see any point in allowing it to be set to non-integral values.) Add hooks to force IGNOREEOF to be defined and require it to have an integer value. Unlike the other cases, here we're trying to be bug-compatible with a rather bogus externally-defined behavior, so I think we need to continue to allow "\set IGNOREEOF whatever". Fix it so that the substitution hook silently replace non-numeric values with "10", so that the stored value always reflects what we're really doing. Add a dummy assign hook for HISTFILE, just so it's always in variables.c's list. We can't require it to be defined always, because that would break the interaction with the PSQL_HISTORY environment variable, so there isn't any change in visible behavior here. Remove tab-complete.c's private list of known variable names, since that's really a maintenance nuisance. Given the preceding changes, there are no control variables it won't show anyway. This does mean that if for some reason you've unset one of the status variables (DBNAME, HOST, etc), that variable would not appear in tab completion for \set. But I think that's fine, for at least two reasons: we shouldn't be encouraging people to use those variables as regular variables, and if someone does do so anyway, why shouldn't it act just like a regular variable? Remove ugly and no-longer-used-anywhere GetVariableNum(). In general, future additions of integer-valued control variables should follow the paradigm of adding an assign hook using ParseVariableNum(), so there's no reason to expect we'd need this again later. Discussion: https://postgr.es/m/17516.1485973973@sss.pgh.pa.us
This commit is contained in:
@ -3247,12 +3247,6 @@ bar
|
||||
fail after having already displayed some rows.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<varname>FETCH_COUNT</varname> is ignored if it is unset or does not
|
||||
have a positive value. It cannot be set to a value that is not
|
||||
syntactically an integer.
|
||||
</para>
|
||||
|
||||
<tip>
|
||||
<para>
|
||||
Although you can use any output format with this feature,
|
||||
@ -3316,10 +3310,8 @@ bar
|
||||
<term><varname>HISTSIZE</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The maximum number of commands to store in the command history.
|
||||
If unset, at most 500 commands are stored by default.
|
||||
If set to a value that is negative or not an integer, no limit is
|
||||
applied.
|
||||
The maximum number of commands to store in the command history
|
||||
(default 500). If set to a negative value, no limit is applied.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
@ -3345,13 +3337,13 @@ bar
|
||||
<term><varname>IGNOREEOF</varname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If unset, sending an <acronym>EOF</> character (usually
|
||||
If set to 1 or less, sending an <acronym>EOF</> character (usually
|
||||
<keycombo action="simul"><keycap>Control</><keycap>D</></>)
|
||||
to an interactive session of <application>psql</application>
|
||||
will terminate the application. If set to a numeric value,
|
||||
that many <acronym>EOF</> characters are ignored before the
|
||||
application terminates. If the variable is set but not to a
|
||||
numeric value, the default is 10.
|
||||
will terminate the application. If set to a larger numeric value,
|
||||
that many consecutive <acronym>EOF</> characters must be typed to
|
||||
make an interactive session terminate. If the variable is set to a
|
||||
non-numeric value, it is interpreted as 10.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user