[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] Why don't custom GUCs show in pg_settings?
From:       "David G. Johnston" <david.g.johnston () gmail ! com>
Date:       2016-04-30 17:01:44
Message-ID: CAKFQuwaz=+mL=WinaPytSEpC7czBA40xOvnibX5hLMiLGPBHMg () mail ! gmail ! com
[Download RAW message or body]

On Sat, Apr 30, 2016 at 9:39 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > I've seen and can work with various work-arounds but it seems odd that
> > pg_settings doesn't show these custom GUCs.
>
> Because we don't know what type they should be.
>
> If we're ever to support custom GUCs properly, rather than as a hack that
> accidentally sorta works, there needs to be a way to declare them and
> establish their properties; whereupon there would be info for pg_settings
> to display.
>

​It seems that a "reasonable defaults"​ policy would be better than
nothing...though given the "missing_ok" feature the work-around with
pg_settings isn't needed.

​The existing set_config would setup the text-oriented defaults while, if
someone cares enough, a set_custom_config (or overloaded set_config)
function could be written that would allow specifying​ stuff like
description, unit, initial value, etc.

But what amounts to a session-local hstore seem, whose contents are
displayed in pg_settings along with the system GUCs, and is documented,
seems like an adequate feature to acknowledge officially.


> > Is there a simple way to read the value without receiving an error if the
> > value is missing?
>
> See 10fb48d66, which I don't particularly approve of because it piled
> another hack on top of that mess without doing a thing to make it cleaner.
>

​Thanks.

I recalled seeing that, just didn't remember that it is new to 9.6 -  I
only looked at the 9.5 documentation and didn't see it.

David J.​

[Attachment #3 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><span \
style="font-family:arial,sans-serif">On Sat, Apr 30, 2016 at 9:39 AM, Tom Lane \
</span><span dir="ltr" style="font-family:arial,sans-serif">&lt;<a \
href="mailto:tgl@sss.pgh.pa.us" target="_blank">tgl@sss.pgh.pa.us</a>&gt;</span><span \
style="font-family:arial,sans-serif"> wrote:</span><br></div><div \
class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span \
class="">&quot;David G. Johnston&quot; &lt;<a \
href="mailto:david.g.johnston@gmail.com">david.g.johnston@gmail.com</a>&gt; \
writes:<br> &gt; I&#39;ve seen and can work with various work-arounds but it seems \
odd that<br> &gt; pg_settings doesn&#39;t show these custom GUCs.<br>
<br>
</span>Because we don&#39;t know what type they should be.<br>
<br>
If we&#39;re ever to support custom GUCs properly, rather than as a hack that<br>
accidentally sorta works, there needs to be a way to declare them and<br>
establish their properties; whereupon there would be info for pg_settings<br>
to display.<br></blockquote><div><br></div><div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif">​It seems that a &quot;reasonable \
defaults&quot;​ policy would be better than nothing...though given the \
&quot;missing_ok&quot; feature the work-around with pg_settings isn&#39;t \
needed.</div></div><div><br></div><div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif">​The existing set_config would setup \
the text-oriented defaults while, if someone cares enough, a set_custom_config (or \
overloaded set_config) function could be written that would allow specifying​ stuff \
like description, unit, initial value, etc.</div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif">But what amounts to a session-local \
hstore seem, whose contents are displayed in pg_settings along with the system GUCs, \
and is documented, seems like an adequate feature to acknowledge \
officially.</div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> <span class=""><br>
&gt; Is there a simple way to read the value without receiving an error if the<br>
&gt; value is missing?<br>
<br>
</span>See 10fb48d66, which I don&#39;t particularly approve of because it piled<br>
another hack on top of that mess without doing a thing to make it cleaner.<br><div \
class="gmail_default" \
style="font-family:arial,helvetica,sans-serif;display:inline"></div></blockquote><div><br></div><div><div \
class="gmail_default" \
style="font-family:arial,helvetica,sans-serif;display:inline">​Thanks.</div></div><div><br></div><div><div \
class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">I \
recalled seeing that, just didn&#39;t remember that it is new to 9.6 -   I only \
looked at the 9.5 documentation and didn&#39;t see it.</div></div><div><div \
class="gmail_default" \
style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div><div><div \
class="gmail_default" \
style="font-family:arial,helvetica,sans-serif;display:inline">David \
J.​</div></div><div><div class="gmail_default" \
style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div></div></div></div>




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic