Re: How about a psql backslash command to show GUCs?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: "Jonathan S. Katz" <jkatz@postgresql.org>, Julien Rouhaud <rjuju123@gmail.com>, Christoph Berg <myon@debian.org>, Pavel Stehule <pavel.stehule@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, Joe Conway <mail@joeconway.com>, Mark Dilger <mark.dilger@enterprisedb.com>, Andrew Dunstan <andrew@dunslane.net>, David Rowley <dgrowleyml@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, pgsql-hackers@lists.postgresql.org
Date: 2022-06-06T16:02:15Z
Lists: pgsql-hackers
Justin Pryzby <pryzby@telsasoft.com> writes:
> I noticed this is showing "pre-computed" gucs, like:
>  shared_memory_size                | 149MB
>  shared_memory_size_in_huge_pages  | 75
> I'm not opposed to that, but I wonder if that's what's intended / best.

I had suggested upthread that we might want to hide items with
source = 'override', but that idea didn't seem to be getting traction.
A different idea is to hide items with context = 'internal'.
Looking at the items selected by the current rule in a default
installation:

postgres=# SELECT s.name, source, context FROM pg_catalog.pg_settings s
WHERE s.source <> 'default' AND
      s.setting IS DISTINCT FROM s.boot_val
ORDER BY 1;
               name               |        source        |  context   
----------------------------------+----------------------+------------
 TimeZone                         | configuration file   | user
 application_name                 | client               | user
 client_encoding                  | client               | user
 config_file                      | override             | postmaster
 data_directory                   | override             | postmaster
 default_text_search_config       | configuration file   | user
 hba_file                         | override             | postmaster
 ident_file                       | override             | postmaster
 lc_messages                      | configuration file   | superuser
 log_timezone                     | configuration file   | sighup
 max_stack_depth                  | environment variable | superuser
 shared_memory_size               | override             | internal
 shared_memory_size_in_huge_pages | override             | internal
 wal_buffers                      | override             | postmaster
(14 rows)

So hiding internal-context items would hit exactly the two you mention,
but hiding override-source items would hit several more.

(I'm kind of wondering why wal_buffers is showing as "override";
that seems like a quirk.)

Thoughts?

			regards, tom lane



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Be more careful about GucSource for internally-driven GUC settings.

  2. Fix case sensitivity in psql's tab completion for GUC names.

  3. Further tweak the default behavior of psql's \dconfig.

  4. Tweak the default behavior of psql's \dconfig.

  5. psql: add \dconfig command to show server's configuration parameters.

  6. Allow granting SET and ALTER SYSTEM privileges on GUC parameters.