mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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:
@ -348,9 +348,9 @@ helpVariables(unsigned short int pager)
|
||||
" (default: 0=unlimited)\n"));
|
||||
fprintf(output, _(" HISTCONTROL controls command history [ignorespace, ignoredups, ignoreboth]\n"));
|
||||
fprintf(output, _(" HISTFILE file name used to store the command history\n"));
|
||||
fprintf(output, _(" HISTSIZE the number of commands to store in the command history\n"));
|
||||
fprintf(output, _(" HISTSIZE max number of commands to store in the command history\n"));
|
||||
fprintf(output, _(" HOST the currently connected database server host\n"));
|
||||
fprintf(output, _(" IGNOREEOF if unset, sending an EOF to interactive session terminates application\n"));
|
||||
fprintf(output, _(" IGNOREEOF number of EOFs needed to terminate an interactive session\n"));
|
||||
fprintf(output, _(" LASTOID value of the last affected OID\n"));
|
||||
fprintf(output, _(" ON_ERROR_ROLLBACK if set, an error doesn't stop a transaction (uses implicit savepoints)\n"));
|
||||
fprintf(output, _(" ON_ERROR_STOP stop batch execution after error\n"));
|
||||
|
Reference in New Issue
Block a user