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

Jonathan S. Katz <jkatz@postgresql.org>

From: "Jonathan S. Katz" <jkatz@postgresql.org>
To: Joe Conway <mail@joeconway.com>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Mark Dilger <mark.dilger@enterprisedb.com>
Date: 2022-04-07T14:39:47Z
Lists: pgsql-hackers
On 4/7/22 8:36 AM, Joe Conway wrote:
> On 4/6/22 23:02, 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.
> 
> WFM -- using some form of \d<something> makes more sense than 
> \s<something>, and I can't think of anything better that \dconf.
> 
> I will say that I care about context far more often than unit or type 
> though, so from my point of view I would switch them around with respect 
> to which is only shown with verbose.

I disagree somewhat -- I agree the context should be in the regular 
view, but unit and type are also important. If I had to choose to drop 
one, I'd choose type as it could be inferred, but I would say better to 
keep them all.

The downside is that by including context, the standard list appears to 
push past my 99px width terminal in non-enhanced view, but that may be OK.


A couple of minor things:

	+	appendPQExpBufferStr(&buf, "ORDER BY 1;");

I don't know how much we do positional ordering in our queries, but it 
may be better to explicitly order by "s.name". I doubt this column name 
is likely to change, and if for some reason someone shuffles the output 
order of \dconf, it makes it less likely to break someone's view.

I did not test this via an extension, but we do allow for mixed case in 
custom GUCs:

postgres=# SHOW jkatz.test;
  JKATZ.test
------------
  abc

I don't know if we want to throw a "LOWER(s.name)" on at least the 
ordering, given we allow for "SHOW" itself to load these case-insensitively.

	+	fprintf(output, _("  \\dconf[+] [PATTERN]    list configuration 
parameters\n"));

Maybe to appeal to all crowds, we say "list configuration parameters 
(GUCs)"?

Thanks,

Jonathan

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.