1010 * Written by Peter Eisentraut <peter_e@gmx.net>.
1111 *
1212 * IDENTIFICATION
13- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.454 2008/05/15 00:17:40 tgl Exp $
13+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.455 2008/05/26 18:54:29 tgl Exp $
1414 *
1515 *--------------------------------------------------------------------
1616 */
@@ -4630,6 +4630,10 @@ set_config_option(const char *name, const char *value,
46304630source = conf -> gen .reset_source ;
46314631}
46324632
4633+ /* Save old value to support transaction abort */
4634+ if (changeVal && !makeDefault )
4635+ push_old_value (& conf -> gen ,action );
4636+
46334637if (conf -> assign_hook )
46344638if (!(* conf -> assign_hook ) (newval ,changeVal ,source ))
46354639{
@@ -4640,32 +4644,26 @@ set_config_option(const char *name, const char *value,
46404644return false;
46414645}
46424646
4643- if (changeVal || makeDefault )
4647+ if (changeVal )
4648+ {
4649+ * conf -> variable = newval ;
4650+ conf -> gen .source = source ;
4651+ }
4652+ if (makeDefault )
46444653{
4645- /* Save old value to support transaction abort */
4646- if (!makeDefault )
4647- push_old_value (& conf -> gen ,action );
4648- if (changeVal )
4654+ GucStack * stack ;
4655+
4656+ if (conf -> gen .reset_source <=source )
46494657{
4650- * conf -> variable = newval ;
4651- conf -> gen .source = source ;
4658+ conf -> reset_val = newval ;
4659+ conf -> gen .reset_source = source ;
46524660}
4653- if ( makeDefault )
4661+ for ( stack = conf -> gen . stack ; stack ; stack = stack -> prev )
46544662{
4655- GucStack * stack ;
4656-
4657- if (conf -> gen .reset_source <=source )
4658- {
4659- conf -> reset_val = newval ;
4660- conf -> gen .reset_source = source ;
4661- }
4662- for (stack = conf -> gen .stack ;stack ;stack = stack -> prev )
4663+ if (stack -> source <=source )
46634664{
4664- if (stack -> source <=source )
4665- {
4666- stack -> prior .boolval = newval ;
4667- stack -> source = source ;
4668- }
4665+ stack -> prior .boolval = newval ;
4666+ stack -> source = source ;
46694667}
46704668}
46714669}
@@ -4707,6 +4705,10 @@ set_config_option(const char *name, const char *value,
47074705source = conf -> gen .reset_source ;
47084706}
47094707
4708+ /* Save old value to support transaction abort */
4709+ if (changeVal && !makeDefault )
4710+ push_old_value (& conf -> gen ,action );
4711+
47104712if (conf -> assign_hook )
47114713if (!(* conf -> assign_hook ) (newval ,changeVal ,source ))
47124714{
@@ -4717,32 +4719,26 @@ set_config_option(const char *name, const char *value,
47174719return false;
47184720}
47194721
4720- if (changeVal || makeDefault )
4722+ if (changeVal )
4723+ {
4724+ * conf -> variable = newval ;
4725+ conf -> gen .source = source ;
4726+ }
4727+ if (makeDefault )
47214728{
4722- /* Save old value to support transaction abort */
4723- if (!makeDefault )
4724- push_old_value (& conf -> gen ,action );
4725- if (changeVal )
4729+ GucStack * stack ;
4730+
4731+ if (conf -> gen .reset_source <=source )
47264732{
4727- * conf -> variable = newval ;
4728- conf -> gen .source = source ;
4733+ conf -> reset_val = newval ;
4734+ conf -> gen .reset_source = source ;
47294735}
4730- if ( makeDefault )
4736+ for ( stack = conf -> gen . stack ; stack ; stack = stack -> prev )
47314737{
4732- GucStack * stack ;
4733-
4734- if (conf -> gen .reset_source <=source )
4735- {
4736- conf -> reset_val = newval ;
4737- conf -> gen .reset_source = source ;
4738- }
4739- for (stack = conf -> gen .stack ;stack ;stack = stack -> prev )
4738+ if (stack -> source <=source )
47404739{
4741- if (stack -> source <=source )
4742- {
4743- stack -> prior .intval = newval ;
4744- stack -> source = source ;
4745- }
4740+ stack -> prior .intval = newval ;
4741+ stack -> source = source ;
47464742}
47474743}
47484744}
@@ -4781,6 +4777,10 @@ set_config_option(const char *name, const char *value,
47814777source = conf -> gen .reset_source ;
47824778}
47834779
4780+ /* Save old value to support transaction abort */
4781+ if (changeVal && !makeDefault )
4782+ push_old_value (& conf -> gen ,action );
4783+
47844784if (conf -> assign_hook )
47854785if (!(* conf -> assign_hook ) (newval ,changeVal ,source ))
47864786{
@@ -4791,32 +4791,26 @@ set_config_option(const char *name, const char *value,
47914791return false;
47924792}
47934793
4794- if (changeVal || makeDefault )
4794+ if (changeVal )
4795+ {
4796+ * conf -> variable = newval ;
4797+ conf -> gen .source = source ;
4798+ }
4799+ if (makeDefault )
47954800{
4796- /* Save old value to support transaction abort */
4797- if (!makeDefault )
4798- push_old_value (& conf -> gen ,action );
4799- if (changeVal )
4801+ GucStack * stack ;
4802+
4803+ if (conf -> gen .reset_source <=source )
48004804{
4801- * conf -> variable = newval ;
4802- conf -> gen .source = source ;
4805+ conf -> reset_val = newval ;
4806+ conf -> gen .reset_source = source ;
48034807}
4804- if ( makeDefault )
4808+ for ( stack = conf -> gen . stack ; stack ; stack = stack -> prev )
48054809{
4806- GucStack * stack ;
4807-
4808- if (conf -> gen .reset_source <=source )
4810+ if (stack -> source <=source )
48094811{
4810- conf -> reset_val = newval ;
4811- conf -> gen .reset_source = source ;
4812- }
4813- for (stack = conf -> gen .stack ;stack ;stack = stack -> prev )
4814- {
4815- if (stack -> source <=source )
4816- {
4817- stack -> prior .realval = newval ;
4818- stack -> source = source ;
4819- }
4812+ stack -> prior .realval = newval ;
4813+ stack -> source = source ;
48204814}
48214815}
48224816}
@@ -4870,6 +4864,10 @@ set_config_option(const char *name, const char *value,
48704864source = conf -> gen .reset_source ;
48714865}
48724866
4867+ /* Save old value to support transaction abort */
4868+ if (changeVal && !makeDefault )
4869+ push_old_value (& conf -> gen ,action );
4870+
48734871if (conf -> assign_hook && newval )
48744872{
48754873const char * hookresult ;
@@ -4907,40 +4905,32 @@ set_config_option(const char *name, const char *value,
49074905}
49084906}
49094907
4910- if (changeVal || makeDefault )
4908+ if (changeVal )
49114909{
4912- /* Save old value to support transaction abort */
4913- if (!makeDefault )
4914- push_old_value (& conf -> gen ,action );
4915- if (changeVal )
4910+ set_string_field (conf ,conf -> variable ,newval );
4911+ conf -> gen .source = source ;
4912+ }
4913+ if (makeDefault )
4914+ {
4915+ GucStack * stack ;
4916+
4917+ if (conf -> gen .reset_source <=source )
49164918{
4917- set_string_field (conf ,conf -> variable ,newval );
4918- conf -> gen .source = source ;
4919+ set_string_field (conf ,& conf -> reset_val ,newval );
4920+ conf -> gen .reset_source = source ;
49194921}
4920- if ( makeDefault )
4922+ for ( stack = conf -> gen . stack ; stack ; stack = stack -> prev )
49214923{
4922- GucStack * stack ;
4923-
4924- if (conf -> gen .reset_source <=source )
4925- {
4926- set_string_field (conf ,& conf -> reset_val ,newval );
4927- conf -> gen .reset_source = source ;
4928- }
4929- for (stack = conf -> gen .stack ;stack ;stack = stack -> prev )
4924+ if (stack -> source <=source )
49304925{
4931- if (stack -> source <=source )
4932- {
4933- set_string_field (conf ,& stack -> prior .stringval ,
4934- newval );
4935- stack -> source = source ;
4936- }
4926+ set_string_field (conf ,& stack -> prior .stringval ,
4927+ newval );
4928+ stack -> source = source ;
49374929}
4938- /* Perhaps we didn't install newval anywhere */
4939- if (newval && !string_field_used (conf ,newval ))
4940- free (newval );
49414930}
49424931}
4943- else if (newval )
4932+ /* Perhaps we didn't install newval anywhere */
4933+ if (newval && !string_field_used (conf ,newval ))
49444934free (newval );
49454935break ;
49464936}
@@ -4974,6 +4964,10 @@ set_config_option(const char *name, const char *value,
49744964source = conf -> gen .reset_source ;
49754965}
49764966
4967+ /* Save old value to support transaction abort */
4968+ if (changeVal && !makeDefault )
4969+ push_old_value (& conf -> gen ,action );
4970+
49774971if (conf -> assign_hook )
49784972if (!(* conf -> assign_hook ) (newval ,changeVal ,source ))
49794973{
@@ -4985,32 +4979,26 @@ set_config_option(const char *name, const char *value,
49854979return false;
49864980}
49874981
4988- if (changeVal || makeDefault )
4982+ if (changeVal )
49894983{
4990- /* Save old value to support transaction abort */
4991- if (!makeDefault )
4992- push_old_value (& conf -> gen ,action );
4993- if (changeVal )
4984+ * conf -> variable = newval ;
4985+ conf -> gen .source = source ;
4986+ }
4987+ if (makeDefault )
4988+ {
4989+ GucStack * stack ;
4990+
4991+ if (conf -> gen .reset_source <=source )
49944992{
4995- * conf -> variable = newval ;
4996- conf -> gen .source = source ;
4993+ conf -> reset_val = newval ;
4994+ conf -> gen .reset_source = source ;
49974995}
4998- if ( makeDefault )
4996+ for ( stack = conf -> gen . stack ; stack ; stack = stack -> prev )
49994997{
5000- GucStack * stack ;
5001-
5002- if (conf -> gen .reset_source <=source )
5003- {
5004- conf -> reset_val = newval ;
5005- conf -> gen .reset_source = source ;
5006- }
5007- for (stack = conf -> gen .stack ;stack ;stack = stack -> prev )
4998+ if (stack -> source <=source )
50084999{
5009- if (stack -> source <=source )
5010- {
5011- stack -> prior .enumval = newval ;
5012- stack -> source = source ;
5013- }
5000+ stack -> prior .enumval = newval ;
5001+ stack -> source = source ;
50145002}
50155003}
50165004}