Re: [PATCH] Cleanup of GUC units code - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Cleanup of GUC units code
Date
Msg-id 16745.1221134278@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Cleanup of GUC units code  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> temp_buffers is actually special-cased in the code because

>     /*
>      * We show the GUC var until local buffers have been initialized, and
>      * NLocBuffer afterwards.
>      */

> It is not clear to me right now why that is a good idea.

I think the reason for it is that you can change the setting within a
particular session, but only up until temp buffers have been initialized
(ie, when you first touch a temp table).  If we just made it act like
other GUCs then SHOW would be lying to you about the effective value
if you changed it after that point.

An easy workaround would be to make the variable PGC_BACKEND, but that
seems to me to lose useful flexibility.  Or we could invent a context
category specifically for this type of behavior, but is it worth that?

The narrowest fix would be to just teach the show hook to format its
result properly.  I seem to recall having looked at that and been
annoyed by the amount of copy-and-paste required.

[ thinks for a bit... ]  Or maybe we should get rid of the show hook
and instead put in an assign hook that prevents changes after the
initialization event.  The problem is that you can't throw error
while reading, eg, a new config file.  So while this might be the most
user-friendly approach, I think it would take some API change for assign
hooks.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: New FSM patch
Next
From: Peter Eisentraut
Date:
Subject: Re: Move src/tools/backend/ to wiki