Re: How about a psql backslash command to show GUCs? - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: How about a psql backslash command to show GUCs?
Date
Msg-id 20220407152449.GD24419@telsasoft.com
Whole thread Raw
In response to Re: How about a psql backslash command to show GUCs?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Apr 06, 2022 at 11:02:54PM -0400, Tom Lane wrote:
> "Jonathan S. Katz" <jkatz@postgresql.org> writes:
> > +1 for \dconf
> 
> Here's a draft patch using \dconf.  No tests or docs yet.

The patch as written is a thin layer around pg_settings.

SHOW and current_setting() translate to human units, which is particularly
useful for some settings, like those with units of 8k pages.  

Is it better to use that "cooked" version for display in the backslash command
instead of the raw view from pg_settings ?

Otherwise, I see myself first using tab completion or, failing that,
SELECT * FROM pg_settings WHERE name~'something', followed by SHOW, to
avoid messing up counting digits, multiplication or unit conversions.

> +    printfPQExpBuffer(&buf,
> +                      "SELECT s.name AS \"%s\", s.setting AS \"%s\", "
> +                      "s.unit AS \"%s\", s.vartype AS \"%s\"",
> +                      gettext_noop("Parameter"),
> +                      gettext_noop("Setting"),
> +                      gettext_noop("Unit"),
> +                      gettext_noop("Type"));
> +

> +    appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_settings s\n");



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: unlogged sequences
Next
From: Guillaume Lelarge
Date:
Subject: Re: REINDEX blocks virtually any queries but some prepared queries.