1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

Tweak the default behavior of psql's \dconfig.

\dconfig without an argument originally printed all parameters,
but it seems more useful to print only those parameters with
non-default settings.  You can easily get the show-everything
behavior with "\dconfig *", but that output is unwieldy and
seems unlikely to be wanted very often.

Per suggestion from Christoph Berg.

Discussion: https://postgr.es/m/YlFQLzlPi4QD0wSi@msg.df7cb.de
This commit is contained in:
Tom Lane 2022-04-11 15:11:46 -04:00
parent 3c702b3ed1
commit 5e70d8b5d1
2 changed files with 17 additions and 9 deletions

View File

@ -129,7 +129,7 @@ echo '\x \\ SELECT * FROM foo;' | psql
for more details about how the server handles multi-query strings.) for more details about how the server handles multi-query strings.)
</para> </para>
<para> <para>
If having several commands executed in one transaction is not desired, If having several commands executed in one transaction is not desired,
use repeated <option>-c</option> commands or feed multiple commands to use repeated <option>-c</option> commands or feed multiple commands to
<application>psql</application>'s standard input, <application>psql</application>'s standard input,
either using <application>echo</application> as illustrated above, or either using <application>echo</application> as illustrated above, or
@ -1385,9 +1385,11 @@ testdb=&gt;
<listitem> <listitem>
<para> <para>
Lists server configuration parameters and their values. Lists server configuration parameters and their values.
If <replaceable class="parameter">pattern</replaceable> If <replaceable class="parameter">pattern</replaceable> is specified,
is specified, only parameters whose names match the pattern are only parameters whose names match the pattern are listed. Without
listed. a <replaceable class="parameter">pattern</replaceable>, only
parameters that are set to non-default values are listed.
(Use <literal>\dconfig *</literal> to see all parameters.)
If <literal>+</literal> is appended to the command name, each If <literal>+</literal> is appended to the command name, each
parameter is listed with its data type, context in which the parameter is listed with its data type, context in which the
parameter can be set, and access privileges (if non-default access parameter can be set, and access privileges (if non-default access

View File

@ -4404,10 +4404,13 @@ describeConfigurationParameters(const char *pattern, bool verbose,
" LEFT JOIN pg_catalog.pg_parameter_acl p\n" " LEFT JOIN pg_catalog.pg_parameter_acl p\n"
" ON pg_catalog.lower(s.name) = p.parname\n"); " ON pg_catalog.lower(s.name) = p.parname\n");
processSQLNamePattern(pset.db, &buf, pattern, if (pattern)
false, false, processSQLNamePattern(pset.db, &buf, pattern,
NULL, "pg_catalog.lower(s.name)", NULL, false, false,
NULL); NULL, "pg_catalog.lower(s.name)", NULL,
NULL);
else
appendPQExpBufferStr(&buf, "WHERE s.source <> 'default'\n");
appendPQExpBufferStr(&buf, "ORDER BY 1;"); appendPQExpBufferStr(&buf, "ORDER BY 1;");
@ -4417,7 +4420,10 @@ describeConfigurationParameters(const char *pattern, bool verbose,
return false; return false;
myopt.nullPrint = NULL; myopt.nullPrint = NULL;
myopt.title = _("List of configuration parameters"); if (pattern)
myopt.title = _("List of configuration parameters");
else
myopt.title = _("List of non-default configuration parameters");
myopt.translate_header = true; myopt.translate_header = true;
printQuery(res, &myopt, pset.queryFout, false, pset.logfile); printQuery(res, &myopt, pset.queryFout, false, pset.logfile);