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

From: Alvaro Herrera <[email-masked]>
Date: Wed, 6 Apr 2022 19:58:02 +0200

On 2022-Apr-06, Tom Lane wrote:

> However, I very often find myself resorting to the much more tedious
> 
> select * from pg_settings where name like '%foo%';
> 
> when I want to see some related parameters, or when I'm a bit
> fuzzy on the exact name of the parameter.

Been there many times, so +1 for the general idea.

> In the discussion about adding privileges for GUCs [1], there
> was a proposal to add a new psql backslash command to show GUCs,
> which could reduce this problem to something like
> 
> \dcp *foo*

+1.  As for command name, I like \show as proposed by Pavel.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/

---

From: Joe Conway <[email-masked]>
Date: Wed, 6 Apr 2022 14:26:36 -0400

> +1.  As for command name, I like \show as proposed by Pavel.

+1

I'd love something for the same reasons.

No as sure about \show though. That seems like it could be confused with 
showing other stuff. Maybe consistent with \sf[+] and \sv[+] we could 
add \sc[+]?

Joe

---

From: Tom Lane <[email-masked]>
Date: Wed, 06 Apr 2022 14:40:40 -0400

> showing other stuff. Maybe consistent with \sf[+] and \sv[+] we could 

Hmm ... my first reaction to that was "no, it should be \sp for
'parameter'".  But with the neighboring \sf for 'function', it'd
be easy to think that maybe 'p' means 'procedure'.

I do agree that \show might be a bad choice, the reason being that
the adjacent \set command is for psql variables not GUCs; if we
had a \show I'd sort of expect it to be a variant spelling of
"\echo :variable".

"\sc" isn't awful perhaps.

Ah, naming ... the hardest problem in computer science.

			regards, tom lane

---

From: "Jonathan S. Katz" <[email-masked]>
Date: Wed, 6 Apr 2022 17:34:36 -0400

> Ah, naming ... the hardest problem in computer science.

(but the easiest thing to have an opinion on ;)

+1 on the feature proposal.

I am a bit torn between "\dcp" (or \dsetting / \dconfig? we don't 
necessarily need for it to be super short) and "\sc". Certainly with 
pattern matching the interface for the "\d" commands would fit that 
pattern. "\sc" would make sense for a thorough introspection of what is 
in the GUC. That said, we get that with SHOW today.

So I'm leaning towards something in the "\d" family.

Thanks,

Jonathan

---

From: Mark Dilger <[email-masked]>
Date: Wed, 6 Apr 2022 15:36:08 -0700

> On Apr 6, 2022, at 2:34 PM, Jonathan S. Katz <[email-masked]> wrote:
> 
> "\sc" would make sense

I originally wrote the command as \dcp (describe configuration parameter) because \dp (describe parameter) wasn't available.  The thing we're showing is a "parameter", not a "config".  If we're going to use a single letter, I'd prefer /p/.

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: David Rowley <[email-masked]>
Date: Thu, 7 Apr 2022 15:25:06 +1200

I also find myself querying pg_settings all too often. More typing
than I'd like.

> had a \show I'd sort of expect it to be a variant spelling of

I also think \show is not a great choice. I'd rather see us follow the
\d pattern for showing information about objects in the database.

> "\sc" isn't awful perhaps.

I think \dG is pretty good. G for GUC.

David