Why don't custom GUCs show in pg_settings?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Why don't custom GUCs show in pg_settings?
Date: 2016-04-30 16:22:52
Message-ID: CAKFQuwZz08Qh2O9_pzbGDsrczwn8Vpz_MK_Zd_-HZRFi7ZO0NA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-04-30 16:39:07 Re: Why don't custom GUCs show in pg_settings?
Previous Message Manuel Gómez 2016-04-30 15:36:11 Re: Skip trigger?