diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-04-04 14:57:17 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-04-04 20:00:33 +0200 |
commit | 7844c9918a43b494adde3575891d217a37062378 (patch) | |
tree | 0f1d5a45abcaef3982545f68a53444bb5e059065 /src/bin/psql/startup.c | |
parent | cbf4177f2ca0b9bbfdb78a6ab51e3876e9ff6eac (diff) |
psql: Show all query results by default
Previously, psql printed only the last result if a command string
returned multiple result sets. Now it prints all of them. The
previous behavior can be obtained by setting the psql variable
SHOW_ALL_RESULTS to off.
This is a significantly enhanced version of
3a5130672296ed4e682403a77a9a3ad3d21cef75 (that was later reverted).
There is also much more test coverage for various psql features now.
Author: Fabien COELHO <coelho@cri.ensmp.fr>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: "Iwata, Aya" <iwata.aya@jp.fujitsu.com> (earlier version)
Reviewed-by: Daniel Verite <daniel@manitou-mail.org> (earlier version)
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> (earlier version)
Reviewed-by: vignesh C <vignesh21@gmail.com> (earlier version)
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r-- | src/bin/psql/startup.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index be9dec749d7..d08b15886aa 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -203,6 +203,7 @@ main(int argc, char *argv[]) SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1); SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2); SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3); + SetVariableBool(pset.vars, "SHOW_ALL_RESULTS"); parse_psql_options(argc, argv, &options); @@ -1150,6 +1151,12 @@ verbosity_hook(const char *newval) return true; } +static bool +show_all_results_hook(const char *newval) +{ + return ParseVariableBool(newval, "SHOW_ALL_RESULTS", &pset.show_all_results); +} + static char * show_context_substitute_hook(char *newval) { @@ -1251,6 +1258,9 @@ EstablishVariableSpace(void) SetVariableHooks(pset.vars, "VERBOSITY", verbosity_substitute_hook, verbosity_hook); + SetVariableHooks(pset.vars, "SHOW_ALL_RESULTS", + bool_substitute_hook, + show_all_results_hook); SetVariableHooks(pset.vars, "SHOW_CONTEXT", show_context_substitute_hook, show_context_hook); |