Why don't custom GUCs show in pg_settings? - Mailing list pgsql-general

From David G. Johnston
Subject Why don't custom GUCs show in pg_settings?
Date
Msg-id CAKFQuwZz08Qh2O9_pzbGDsrczwn8Vpz_MK_Zd_-HZRFi7ZO0NA@mail.gmail.com
Whole thread Raw
Responses Re: Why don't custom GUCs show in pg_settings?
List pgsql-general
Version - 9.5
O/S - not applicable

SELECT set_config('davidj.testvar', 'value');
SELECT current_setting('davidj.testvar') --value
SELECT * FROM pg_settings WHERE name ~ 'testvar'  --or ~davidj... either way nothing shows

and:

SELECT current_setting('davidj.testvar2') -- unrecognized configuration parameter

The underlying goal is to use the custom GUC within a CREATE VIEW in a where clause.  If the user issues a valid set_config for the GUC the query is appropriately filtered otherwise I set things up so that particular clause will not apply.

I've seen and can work with various work-arounds but it seems odd that pg_settings doesn't show these custom GUCs.

Is there a simple way to read the value without receiving an error if the value is missing?

David J.

pgsql-general by date:

Previous
From: Manuel Gómez
Date:
Subject: Re: Skip trigger?
Next
From: Tom Lane
Date:
Subject: Re: Why don't custom GUCs show in pg_settings?