Re: Docs incorrectly claiming equivalence between show and pg_settings

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stefan Seifert <nine(at)detonation(dot)org>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Docs incorrectly claiming equivalence between show and pg_settings
Date: 2014-04-19 17:10:39
Message-ID: 20140419171039.GA23526@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Wed, Feb 12, 2014 at 03:54:31PM +0100, Stefan Seifert wrote:
> Hi!
>
> http://www.postgresql.org/docs/devel/static/sql-show.html claims:
> "Also, the pg_settings system view produces the same information."
>
> This is not entirely correct. On IRC I was told, that the view only contains
> settings set from C, not user defined settings defined by the SET command:
>
> timemngt=# set my.test = 'test';
> SET
> timemngt=# show my.test;
> ┌─────────┐
> │ my.test │
> ├─────────┤
> │ test │
> └─────────┘
> (1 row)
>
> timemngt=# select * from pg_settings where name = 'my.test';
> timemngt=#
>
> Including this rather obscure bit of information might help another user down
> the road.

This is an interesting report. You are correct that there are several
places in the docs that say that SHOW and pg_settings display the same
information, and even state that pg_settings shows _more_ information
than SHOW.

However, in the case of custom variables, you are right that pg_settings
doesn't show custom variables. I have found the place in the code
where we do that using GUC_NO_SHOW_ALL.

I believe the original reason for this is that custom variables were
designed to modify plugin languages and therefore not useful for people
doing SHOW ALL, but if you specifically asked for it, it would show it
to you. Because pg_settings is built as a view, the API doesn't really
have an ALL mode.

We can do a few things:

1 show custom variables in SHOW ALL and pg_settings
2 show custom and other non-SHOW-ALL variables in pg_settings
3 document this restriction

I am not sure which approach is best. I am attaching a patch that does
#1.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
guc.diff text/x-diff 720 bytes

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2014-04-19 17:12:57 Re: [DOCS] Docs incorrectly claiming equivalence between show and pg_settings
Previous Message Bruce Momjian 2014-04-19 14:53:29 Re: PATCH: Warn users about tablespace abuse data loss risk

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-04-19 17:12:57 Re: [DOCS] Docs incorrectly claiming equivalence between show and pg_settings
Previous Message Bruce Momjian 2014-04-19 12:42:07 Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink