Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbYmw-0001no-Jv for pgsql-docs@arkaria.postgresql.org; Sat, 19 Apr 2014 17:10:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WbYmv-0006bF-Rn for pgsql-docs@arkaria.postgresql.org; Sat, 19 Apr 2014 17:10:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbYmu-0006b8-Ua for pgsql-docs@postgresql.org; Sat, 19 Apr 2014 17:10:48 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WbYmn-0004fV-Dv for pgsql-docs@postgresql.org; Sat, 19 Apr 2014 17:10:48 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1WbYml-0000s0-JB; Sat, 19 Apr 2014 13:10:39 -0400 Date: Sat, 19 Apr 2014 13:10:39 -0400 From: Bruce Momjian To: Stefan Seifert Cc: pgsql-docs@postgresql.org Subject: Re: Docs incorrectly claiming equivalence between show and pg_settings Message-ID: <20140419171039.GA23526@momjian.us> References: <6963016.0JgteVRq9S@sunshine.detonation.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6963016.0JgteVRq9S@sunshine.detonation.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --AhhlLboLdkugWU4S Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + --AhhlLboLdkugWU4S Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="guc.diff" diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c new file mode 100644 index 15020c4..c0f9880 *** a/src/backend/utils/misc/guc.c --- b/src/backend/utils/misc/guc.c *************** add_placeholder_variable(const char *nam *** 3929,3936 **** gen->context = PGC_USERSET; gen->group = CUSTOM_OPTIONS; ! gen->short_desc = "GUC placeholder variable"; ! gen->flags = GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_CUSTOM_PLACEHOLDER; gen->vartype = PGC_STRING; /* --- 3929,3936 ---- gen->context = PGC_USERSET; gen->group = CUSTOM_OPTIONS; ! gen->short_desc = "Custom variable."; ! gen->flags = GUC_NOT_IN_SAMPLE | GUC_CUSTOM_PLACEHOLDER; gen->vartype = PGC_STRING; /* --AhhlLboLdkugWU4S Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --AhhlLboLdkugWU4S--