Re: guc patch: Make variables fall back to default values

Lists: pgsql-patches
From: Joachim Wieland <joe(at)mcknight(dot)de>
To: pgsql-patches(at)postgresql(dot)org
Subject: guc patch: Make variables fall back to default values
Date: 2007-02-19 13:07:48
Message-ID: 20070219130748.GA4994@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Attached is the long-awaited guc patch that makes values fall back to their
default values when they got removed (or commented) from the configuration
file. This has always been a source of confusion.

There are three not-so-obvious cases that I'd like to comment:

First one:

In the configuration file you have:

seq_page_cost = 3 (the default for this option is 1)

You start the database and issue "SET seq_page_cost TO 4".

Then you remove the seq_page_cost definition from the configuration file and
send SIGHUP.

If you now do a "RESET seq_page_cost" it will fall back to 1 and not to 3.

Second one:

You have custom_variable_classes = "foo"

You start a transaction and do "SET foo.bar to 4".

Now you remove the custom_variable_classes definition and it falls back to
being empty. Hence all foo.* variables become invalid. You cannot COMMIT the
transaction and COMMIT results in a transaction abort.

Third one:

In the configuration file you have

custom_variable_classes = "foo"
foo.bar = 3

You start a transaction and do "SET foo.bar to 4". Then you remove the
definition of "foo.bar" but you keep the custom_variable_classes definition.
COMMITting the transaction succeeds but since foo.bar does not exist in the
configuration file anymore, your SET command is considered to define a new
variable and executing "RESET foo.bar" does not change the variable (without
any change to the configuration file it would remove your setting and
restore the setting from the configuration file for "foo.bar").

Everything else should be quite straightforward. It is also intended that if
you have changed (or commented) a variable in the configuration file that
cannot be applied (because a parameter can only be changed at server start)
you will get this message every time you send a SIGHUP. That way you can see
if your configuration file matches your current server configuration.

Comments welcome,

Joachim

Attachment Content-Type Size
pg_guc_default.diff text/x-diff 24.9 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-02-20 22:13:14
Message-ID: 200702202213.l1KMDEe12578@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Joachim Wieland wrote:
> Attached is the long-awaited guc patch that makes values fall back to their
> default values when they got removed (or commented) from the configuration
> file. This has always been a source of confusion.
>
> There are three not-so-obvious cases that I'd like to comment:
>
> First one:
>
> In the configuration file you have:
>
> seq_page_cost = 3 (the default for this option is 1)
>
> You start the database and issue "SET seq_page_cost TO 4".
>
> Then you remove the seq_page_cost definition from the configuration file and
> send SIGHUP.
>
> If you now do a "RESET seq_page_cost" it will fall back to 1 and not to 3.
>
>
>
> Second one:
>
> You have custom_variable_classes = "foo"
>
> You start a transaction and do "SET foo.bar to 4".
>
> Now you remove the custom_variable_classes definition and it falls back to
> being empty. Hence all foo.* variables become invalid. You cannot COMMIT the
> transaction and COMMIT results in a transaction abort.
>
>
>
> Third one:
>
> In the configuration file you have
>
> custom_variable_classes = "foo"
> foo.bar = 3
>
> You start a transaction and do "SET foo.bar to 4". Then you remove the
> definition of "foo.bar" but you keep the custom_variable_classes definition.
> COMMITting the transaction succeeds but since foo.bar does not exist in the
> configuration file anymore, your SET command is considered to define a new
> variable and executing "RESET foo.bar" does not change the variable (without
> any change to the configuration file it would remove your setting and
> restore the setting from the configuration file for "foo.bar").
>
>
>
> Everything else should be quite straightforward. It is also intended that if
> you have changed (or commented) a variable in the configuration file that
> cannot be applied (because a parameter can only be changed at server start)
> you will get this message every time you send a SIGHUP. That way you can see
> if your configuration file matches your current server configuration.
>
>
>
> Comments welcome,
>
> Joachim
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Joachim Wieland <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-10 20:35:38
Message-ID: 200703102135.38560.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland wrote:
> Attached is the long-awaited guc patch that makes values fall back to
> their default values when they got removed (or commented) from the
> configuration file. This has always been a source of confusion.

This patch makes, in its source code comments and error messages, overly
enthusiastic references to the fact that a parameter setting was
supposedly "commented". The only information that is really available,
however, is that the parameter setting disappeared from the
configuration file, and we should not be making other claims.

Another issue that strikes me is that the GUC code apparently makes
mixed used of palloc and guc_malloc, and this patch continues that.
I'm not sure if this is really well thought out.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-10 22:47:20
Message-ID: 20070310224720.GA14588@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Sat, Mar 10, 2007 at 09:35:38PM +0100, Peter Eisentraut wrote:
> This patch makes, in its source code comments and error messages, overly
> enthusiastic references to the fact that a parameter setting was
> supposedly "commented". The only information that is really available,
> however, is that the parameter setting disappeared from the
> configuration file, and we should not be making other claims.

Okay, this is an easy fix.

> Another issue that strikes me is that the GUC code apparently makes
> mixed used of palloc and guc_malloc, and this patch continues that.

True, there is some confusion in the GUC code about what allocation routine
should be used. I tried to use the same allocation method as an
already-existing similar allocation.
To lessen this confusion, can you do some cleanup work on the current GUC
code in this area that I can use as a basis for a revised version of the
patch?

Did you also do tests on the functional aspects of the patch?

Joachim


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Joachim Wieland <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-12 22:10:54
Message-ID: 200703122310.54700.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland wrote:
> Attached is the long-awaited guc patch that makes values fall back to
> their default values when they got removed (or commented) from the
> configuration file. This has always been a source of confusion.

I have applied your patch with some of the discussed corrections. The
use of memory allocation in the GUC code might still need some review.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: <pgsql-patches(at)postgresql(dot)org>, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-12 23:43:27
Message-ID: 87ird6owo0.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


"Peter Eisentraut" <peter_e(at)gmx(dot)net> writes:

> Joachim Wieland wrote:
>> Attached is the long-awaited guc patch that makes values fall back to
>> their default values when they got removed (or commented) from the
>> configuration file. This has always been a source of confusion.
>
> I have applied your patch with some of the discussed corrections. The
> use of memory allocation in the GUC code might still need some review.

This is a pretty major user-visible change. While I'm strongly in favour of it
it seems like there ought to be some documentation file touched by this, no?
Or have I missed it?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 07:39:31
Message-ID: 200703130839.31808.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Gregory Stark wrote:
> This is a pretty major user-visible change. While I'm strongly in
> favour of it it seems like there ought to be some documentation file
> touched by this, no? Or have I missed it?

In my opinion, and possibly that of others who have worked on this
issue, the old behavior was a pretty much a bug and now it works as
expected. Not sure how to document that.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-patches(at)postgresql(dot)org, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 08:05:37
Message-ID: 26287.1173773137@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Gregory Stark wrote:
>> This is a pretty major user-visible change. While I'm strongly in
>> favour of it it seems like there ought to be some documentation file
>> touched by this, no? Or have I missed it?

> In my opinion, and possibly that of others who have worked on this
> issue, the old behavior was a pretty much a bug and now it works as
> expected. Not sure how to document that.

It's a release-note item ... assuming that it doesn't get reverted in
the near future. Could we have some attention to the all-red buildfarm?

regards, tom lane


From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, <pgsql-patches(at)postgresql(dot)org>, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 08:22:17
Message-ID: 871wjtpn7q.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> It's a release-note item ... assuming that it doesn't get reverted in
> the near future. Could we have some attention to the all-red buildfarm?

It's not just a bug. There's code missing.

The code seems to assume that all custom variables are strings. There are
about half a dozen Assert(variable->vartype == PGC_STRING) throughout the
patch. That's not true, plperl's use_strict is a boolean and we have
DefineCustome*Variable functions for each type of variable. Perl bombs because
plperl.use_strict is a boolean.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 10:54:18
Message-ID: 20070313105418.GA18913@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Tue, Mar 13, 2007 at 08:22:17AM +0000, Gregory Stark wrote:
> The code seems to assume that all custom variables are strings. There are
> about half a dozen Assert(variable->vartype == PGC_STRING) throughout the
> patch. That's not true, plperl's use_strict is a boolean and we have
> DefineCustome*Variable functions for each type of variable. Perl bombs
> because plperl.use_strict is a boolean.

The attached patch removes those Asserts.

But this is not the whole story. I wonder why setting "plperl.use_strict"
is supposed to work at all? Where is the corresponding definition of
"plperl" as a custom variable class? I can add it manually to
postgresql.conf and make the regression tests work but is this the intended
way?

Joachim

Attachment Content-Type Size
guc-string-asserts.diff text/x-diff 2.6 KB

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 13:29:14
Message-ID: 45F6A72A.30003@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland wrote:
> On Tue, Mar 13, 2007 at 08:22:17AM +0000, Gregory Stark wrote:
>
>> The code seems to assume that all custom variables are strings. There are
>> about half a dozen Assert(variable->vartype == PGC_STRING) throughout the
>> patch. That's not true, plperl's use_strict is a boolean and we have
>> DefineCustome*Variable functions for each type of variable. Perl bombs
>> because plperl.use_strict is a boolean.
>>
>
> The attached patch removes those Asserts.
>
> But this is not the whole story. I wonder why setting "plperl.use_strict"
> is supposed to work at all? Where is the corresponding definition of
> "plperl" as a custom variable class? I can add it manually to
> postgresql.conf and make the regression tests work but is this the intended
> way?
>
>
>

The whole custom variable gadget is a mess, IMNSHO, and almost
completely undocumented. If anyone comes up with a sane, workable and
documented design I'll be happy.

As I understand the way custom variable class works (or is supposed to
work), you need it if the variable is set in advance of the call to
define it (e.g. in postgresql.conf) but not if you set if after.

cheers

andrew


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 14:19:54
Message-ID: 1944.1173795594@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> It's not just a bug. There's code missing.

> The code seems to assume that all custom variables are strings. There are
> about half a dozen Assert(variable->vartype == PGC_STRING) throughout the
> patch. That's not true, plperl's use_strict is a boolean and we have
> DefineCustome*Variable functions for each type of variable.

Well, they *are* strings as long as they're "custom". Once a
DefineCustomFoo has been executed, there (should be) no difference
between a "custom" variable and a hard-wired one.

The thing that I was wondering about is the same Joachim mentioned: how
is it that the regression test ever worked? The answer is that it's
not really testing custom variables, because it doesn't try to set
plperl.use_strict until after plperl has been loaded into the current
session. So by that time the variable exists and should look like a
perfectly ordinary boolean GUC variable. The fact that it doesn't look
like that says to me that there's something wrong with the patch logic,
over and above the question of what it should be Asserting.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Joachim Wieland <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 14:33:17
Message-ID: 200703131533.18889.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Peter Eisentraut wrote:
> Joachim Wieland wrote:
> > Attached is the long-awaited guc patch that makes values fall back
> > to their default values when they got removed (or commented) from
> > the configuration file. This has always been a source of confusion.
>
> I have applied your patch with some of the discussed corrections.
> The use of memory allocation in the GUC code might still need some
> review.

Reverted for further fixes. Attached is the latest patch I was working
with.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Attachment Content-Type Size
guc-reset.diff text/x-diff 24.9 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-patches(at)postgresql(dot)org, "Joachim Wieland" <joe(at)mcknight(dot)de>
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 14:47:40
Message-ID: 200703131547.41285.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Tom Lane wrote:
> The thing that I was wondering about is the same Joachim mentioned:
> how is it that the regression test ever worked? The answer is that
> it's not really testing custom variables, because it doesn't try to
> set plperl.use_strict until after plperl has been loaded into the
> current session.

I think that the sole purpose of c_v_c is to allow custom variables in
the configuration file, because that is possibly read before modules
are loaded. Basically it just means that "prefix.*" is not rejected.
In a session, it doesn't make a difference what c_v_c is set to; the
variable needs to be registered period. However, if the registration
code runs only when the module is invoked for the first time rather
than at the start of the session (as in the case of plperl), then it's
apparently impossible to set a variable in a session before the first
call. It's all very weird.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 15:05:39
Message-ID: 20070313150539.GA20370@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Tue, Mar 13, 2007 at 10:19:54AM -0400, Tom Lane wrote:
> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> > It's not just a bug. There's code missing.

> > The code seems to assume that all custom variables are strings. There are
> > about half a dozen Assert(variable->vartype == PGC_STRING) throughout the
> > patch. That's not true, plperl's use_strict is a boolean and we have
> > DefineCustome*Variable functions for each type of variable.

> Well, they *are* strings as long as they're "custom". Once a
> DefineCustomFoo has been executed, there (should be) no difference
> between a "custom" variable and a hard-wired one.

The code in question is the only place that calls one of the
DefineCustom*Variable functions. But those functions set
var->group = CUSTOM_OPTIONS what makes variables look like custom variables
defined via SQL or the config file but in reality they aren't. Hence the
confusion of the type assertion.

> The thing that I was wondering about is the same Joachim mentioned: how
> is it that the regression test ever worked? The answer is that it's
> not really testing custom variables, because it doesn't try to set
> plperl.use_strict until after plperl has been loaded into the current
> session. So by that time the variable exists and should look like a
> perfectly ordinary boolean GUC variable. The fact that it doesn't look
> like that says to me that there's something wrong with the patch logic,
> over and above the question of what it should be Asserting.

What is wrong is that plperl defines a variable that is a mix of a guc
variable and a custom variable. It claims being a custom variable by setting
var->group = CUSTOM_OPTIONS but it does not set the respective
custom_variable_class and so by definition it can't be a custom variable.

Joachim


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 15:08:52
Message-ID: 2377.1173798532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland <joe(at)mcknight(dot)de> writes:
> On Tue, Mar 13, 2007 at 10:19:54AM -0400, Tom Lane wrote:
>> Well, they *are* strings as long as they're "custom". Once a
>> DefineCustomFoo has been executed, there (should be) no difference
>> between a "custom" variable and a hard-wired one.

> The code in question is the only place that calls one of the
> DefineCustom*Variable functions. But those functions set
> var->group = CUSTOM_OPTIONS what makes variables look like custom variables
> defined via SQL or the config file but in reality they aren't. Hence the
> confusion of the type assertion.

My point here that you shouldn't be using var->group to make any
semantic choices. That's supposed to be a label for user convenience,
nothing else.

regards, tom lane


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 15:31:12
Message-ID: 20070313153112.GA20582@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Tue, Mar 13, 2007 at 11:08:52AM -0400, Tom Lane wrote:
> Joachim Wieland <joe(at)mcknight(dot)de> writes:
> > On Tue, Mar 13, 2007 at 10:19:54AM -0400, Tom Lane wrote:
> >> Well, they *are* strings as long as they're "custom". Once a
> >> DefineCustomFoo has been executed, there (should be) no difference
> >> between a "custom" variable and a hard-wired one.

> > The code in question is the only place that calls one of the
> > DefineCustom*Variable functions. But those functions set
> > var->group = CUSTOM_OPTIONS what makes variables look like custom variables
> > defined via SQL or the config file but in reality they aren't. Hence the
> > confusion of the type assertion.

> My point here that you shouldn't be using var->group to make any
> semantic choices. That's supposed to be a label for user convenience,
> nothing else.

Then what is the criterion to tell what is a custom variable and what isn't?
If it contains a dot in the name it is? This wouldn't resolve the problem at
hand either... :-(

We might have to think about custom variables as a whole, what we have now
seems like a very unclear definition and everybody has his own opinion about
what it is and how it works (and I'm not excluding myself here :-)).

Joachim


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 15:52:38
Message-ID: 2819.1173801158@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland <joe(at)mcknight(dot)de> writes:
> On Tue, Mar 13, 2007 at 11:08:52AM -0400, Tom Lane wrote:
>> My point here that you shouldn't be using var->group to make any
>> semantic choices. That's supposed to be a label for user convenience,
>> nothing else.

> Then what is the criterion to tell what is a custom variable and what isn't?

Why do you need to tell that? IMHO, once the DefineCustomFoo function
has been executed, it should be exactly like any other variable (other
than having a funny name).

regards, tom lane


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 16:22:20
Message-ID: 20070313162220.GA20925@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Tue, Mar 13, 2007 at 11:52:38AM -0400, Tom Lane wrote:
> > Then what is the criterion to tell what is a custom variable and what isn't?
> Why do you need to tell that? IMHO, once the DefineCustomFoo function
> has been executed, it should be exactly like any other variable (other
> than having a funny name).

For example for the fall-back-to-default patch. I might not need to tell if
it has been introduced by one of the DefineCustomFoo functions but for the
"other" custom variables. Imagine that we have defined a custom variable via
the configuration file, remove it and send SIGHUP. My understanding is that
this variable should then be deleted from the pool of valid variables
because it falls back to its default value and the default value of a custom
variable is its non-existance.

Joachim


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-13 16:36:34
Message-ID: 3445.1173803794@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Joachim Wieland <joe(at)mcknight(dot)de> writes:
> On Tue, Mar 13, 2007 at 11:52:38AM -0400, Tom Lane wrote:
>> Why do you need to tell that? IMHO, once the DefineCustomFoo function
>> has been executed, it should be exactly like any other variable (other
>> than having a funny name).

> For example for the fall-back-to-default patch. I might not need to tell if
> it has been introduced by one of the DefineCustomFoo functions but for the
> "other" custom variables. Imagine that we have defined a custom variable via
> the configuration file, remove it and send SIGHUP. My understanding is that
> this variable should then be deleted from the pool of valid variables
> because it falls back to its default value and the default value of a custom
> variable is its non-existance.

Once DefineCustomFoo has been executed, you have a reset value to fall
back to. I think what you really want is to recognize variables that
are in the placeholder state, and have them go away as above.
For that you check the GUC_CUSTOM_PLACEHOLDER flag. In any case there
must never be any use of var->group for decision making; that's simply
wrong.

However, ISTM that forcing variables to go away is useless extra code.
What purpose does it serve? Not error checking, because you already
accepted the variable before. Surely you wouldn't argue that, say,
reverting to a prior setting of check_function_bodies should cause the
system to go back and validate a CREATE FUNCTION command it has already
accepted. Moreover, while you could perhaps argue that the "principle
of least surprise" cuts either way here, it seems to me there's a good
argument for not throwing away variables: you might be discarding data
the user needed. So I'd vote for just leaving them there.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joachim Wieland <joe(at)mcknight(dot)de>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-22 20:58:09
Message-ID: 200703222058.l2MKw9V09328@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Is there a new version of this patch being worked on?

---------------------------------------------------------------------------

Tom Lane wrote:
> Joachim Wieland <joe(at)mcknight(dot)de> writes:
> > On Tue, Mar 13, 2007 at 11:52:38AM -0400, Tom Lane wrote:
> >> Why do you need to tell that? IMHO, once the DefineCustomFoo function
> >> has been executed, it should be exactly like any other variable (other
> >> than having a funny name).
>
> > For example for the fall-back-to-default patch. I might not need to tell if
> > it has been introduced by one of the DefineCustomFoo functions but for the
> > "other" custom variables. Imagine that we have defined a custom variable via
> > the configuration file, remove it and send SIGHUP. My understanding is that
> > this variable should then be deleted from the pool of valid variables
> > because it falls back to its default value and the default value of a custom
> > variable is its non-existance.
>
> Once DefineCustomFoo has been executed, you have a reset value to fall
> back to. I think what you really want is to recognize variables that
> are in the placeholder state, and have them go away as above.
> For that you check the GUC_CUSTOM_PLACEHOLDER flag. In any case there
> must never be any use of var->group for decision making; that's simply
> wrong.
>
> However, ISTM that forcing variables to go away is useless extra code.
> What purpose does it serve? Not error checking, because you already
> accepted the variable before. Surely you wouldn't argue that, say,
> reverting to a prior setting of check_function_bodies should cause the
> system to go back and validate a CREATE FUNCTION command it has already
> accepted. Moreover, while you could perhaps argue that the "principle
> of least surprise" cuts either way here, it seems to me there's a good
> argument for not throwing away variables: you might be discarding data
> the user needed. So I'd vote for just leaving them there.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-03-22 22:12:18
Message-ID: 20070322221218.GA13329@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, Mar 22, 2007 at 04:58:09PM -0400, Bruce Momjian wrote:
> Is there a new version of this patch being worked on?

Yes, I will submit a new version next week.

Joachim


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joachim Wieland <joe(at)mcknight(dot)de>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-04-02 23:25:46
Message-ID: 200704022325.l32NPkp21439@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


I assume this patch is not ready for 8.3, so I added a URL to the TODO
list for it.

---------------------------------------------------------------------------

Tom Lane wrote:
> Joachim Wieland <joe(at)mcknight(dot)de> writes:
> > On Tue, Mar 13, 2007 at 11:52:38AM -0400, Tom Lane wrote:
> >> Why do you need to tell that? IMHO, once the DefineCustomFoo function
> >> has been executed, it should be exactly like any other variable (other
> >> than having a funny name).
>
> > For example for the fall-back-to-default patch. I might not need to tell if
> > it has been introduced by one of the DefineCustomFoo functions but for the
> > "other" custom variables. Imagine that we have defined a custom variable via
> > the configuration file, remove it and send SIGHUP. My understanding is that
> > this variable should then be deleted from the pool of valid variables
> > because it falls back to its default value and the default value of a custom
> > variable is its non-existance.
>
> Once DefineCustomFoo has been executed, you have a reset value to fall
> back to. I think what you really want is to recognize variables that
> are in the placeholder state, and have them go away as above.
> For that you check the GUC_CUSTOM_PLACEHOLDER flag. In any case there
> must never be any use of var->group for decision making; that's simply
> wrong.
>
> However, ISTM that forcing variables to go away is useless extra code.
> What purpose does it serve? Not error checking, because you already
> accepted the variable before. Surely you wouldn't argue that, say,
> reverting to a prior setting of check_function_bodies should cause the
> system to go back and validate a CREATE FUNCTION command it has already
> accepted. Moreover, while you could perhaps argue that the "principle
> of least surprise" cuts either way here, it seems to me there's a good
> argument for not throwing away variables: you might be discarding data
> the user needed. So I'd vote for just leaving them there.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-04-03 19:17:05
Message-ID: 20070403191705.GA29713@mcknight.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Mon, Apr 02, 2007 at 07:25:46PM -0400, Bruce Momjian wrote:
> I assume this patch is not ready for 8.3, so I added a URL to the TODO
> list for it.

I have reworked it such that it ignores custom variable templates as Tom
suggested. Attached is the new version.

Joachim

Attachment Content-Type Size
pg_guc_default.diff text/x-diff 18.2 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-04-03 22:26:22
Message-ID: 200704032226.l33MQMw21789@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Joachim Wieland wrote:
> On Mon, Apr 02, 2007 at 07:25:46PM -0400, Bruce Momjian wrote:
> > I assume this patch is not ready for 8.3, so I added a URL to the TODO
> > list for it.
>
> I have reworked it such that it ignores custom variable templates as Tom
> suggested. Attached is the new version.
>
>
> Joachim

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Joachim Wieland <joe(at)mcknight(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: guc patch: Make variables fall back to default values
Date: 2007-04-22 13:27:47
Message-ID: 200704221327.l3MDRlo10250@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied by Peter. Thanks.

---------------------------------------------------------------------------

Joachim Wieland wrote:
> On Mon, Apr 02, 2007 at 07:25:46PM -0400, Bruce Momjian wrote:
> > I assume this patch is not ready for 8.3, so I added a URL to the TODO
> > list for it.
>
> I have reworked it such that it ignores custom variable templates as Tom
> suggested. Attached is the new version.
>
>
> Joachim

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +