diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f4466ddb14..bc38810a81 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.454 2008/05/15 00:17:40 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.455 2008/05/26 18:54:29 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -4630,6 +4630,10 @@ set_config_option(const char *name, const char *value, source = conf->gen.reset_source; } + /* Save old value to support transaction abort */ + if (changeVal && !makeDefault) + push_old_value(&conf->gen, action); + if (conf->assign_hook) if (!(*conf->assign_hook) (newval, changeVal, source)) { @@ -4640,32 +4644,26 @@ set_config_option(const char *name, const char *value, return false; } - if (changeVal || makeDefault) + if (changeVal) { - /* Save old value to support transaction abort */ - if (!makeDefault) - push_old_value(&conf->gen, action); - if (changeVal) - { - *conf->variable = newval; - conf->gen.source = source; - } - if (makeDefault) - { - GucStack *stack; + *conf->variable = newval; + conf->gen.source = source; + } + if (makeDefault) + { + GucStack *stack; - if (conf->gen.reset_source <= source) + if (conf->gen.reset_source <= source) + { + conf->reset_val = newval; + conf->gen.reset_source = source; + } + for (stack = conf->gen.stack; stack; stack = stack->prev) + { + if (stack->source <= source) { - conf->reset_val = newval; - conf->gen.reset_source = source; - } - for (stack = conf->gen.stack; stack; stack = stack->prev) - { - if (stack->source <= source) - { - stack->prior.boolval = newval; - stack->source = source; - } + stack->prior.boolval = newval; + stack->source = source; } } } @@ -4707,6 +4705,10 @@ set_config_option(const char *name, const char *value, source = conf->gen.reset_source; } + /* Save old value to support transaction abort */ + if (changeVal && !makeDefault) + push_old_value(&conf->gen, action); + if (conf->assign_hook) if (!(*conf->assign_hook) (newval, changeVal, source)) { @@ -4717,32 +4719,26 @@ set_config_option(const char *name, const char *value, return false; } - if (changeVal || makeDefault) + if (changeVal) { - /* Save old value to support transaction abort */ - if (!makeDefault) - push_old_value(&conf->gen, action); - if (changeVal) - { - *conf->variable = newval; - conf->gen.source = source; - } - if (makeDefault) - { - GucStack *stack; + *conf->variable = newval; + conf->gen.source = source; + } + if (makeDefault) + { + GucStack *stack; - if (conf->gen.reset_source <= source) + if (conf->gen.reset_source <= source) + { + conf->reset_val = newval; + conf->gen.reset_source = source; + } + for (stack = conf->gen.stack; stack; stack = stack->prev) + { + if (stack->source <= source) { - conf->reset_val = newval; - conf->gen.reset_source = source; - } - for (stack = conf->gen.stack; stack; stack = stack->prev) - { - if (stack->source <= source) - { - stack->prior.intval = newval; - stack->source = source; - } + stack->prior.intval = newval; + stack->source = source; } } } @@ -4781,6 +4777,10 @@ set_config_option(const char *name, const char *value, source = conf->gen.reset_source; } + /* Save old value to support transaction abort */ + if (changeVal && !makeDefault) + push_old_value(&conf->gen, action); + if (conf->assign_hook) if (!(*conf->assign_hook) (newval, changeVal, source)) { @@ -4791,32 +4791,26 @@ set_config_option(const char *name, const char *value, return false; } - if (changeVal || makeDefault) + if (changeVal) { - /* Save old value to support transaction abort */ - if (!makeDefault) - push_old_value(&conf->gen, action); - if (changeVal) - { - *conf->variable = newval; - conf->gen.source = source; - } - if (makeDefault) - { - GucStack *stack; + *conf->variable = newval; + conf->gen.source = source; + } + if (makeDefault) + { + GucStack *stack; - if (conf->gen.reset_source <= source) + if (conf->gen.reset_source <= source) + { + conf->reset_val = newval; + conf->gen.reset_source = source; + } + for (stack = conf->gen.stack; stack; stack = stack->prev) + { + if (stack->source <= source) { - conf->reset_val = newval; - conf->gen.reset_source = source; - } - for (stack = conf->gen.stack; stack; stack = stack->prev) - { - if (stack->source <= source) - { - stack->prior.realval = newval; - stack->source = source; - } + stack->prior.realval = newval; + stack->source = source; } } } @@ -4870,6 +4864,10 @@ set_config_option(const char *name, const char *value, source = conf->gen.reset_source; } + /* Save old value to support transaction abort */ + if (changeVal && !makeDefault) + push_old_value(&conf->gen, action); + if (conf->assign_hook && newval) { const char *hookresult; @@ -4907,40 +4905,32 @@ set_config_option(const char *name, const char *value, } } - if (changeVal || makeDefault) + if (changeVal) { - /* Save old value to support transaction abort */ - if (!makeDefault) - push_old_value(&conf->gen, action); - if (changeVal) - { - set_string_field(conf, conf->variable, newval); - conf->gen.source = source; - } - if (makeDefault) - { - GucStack *stack; + set_string_field(conf, conf->variable, newval); + conf->gen.source = source; + } + if (makeDefault) + { + GucStack *stack; - if (conf->gen.reset_source <= source) + if (conf->gen.reset_source <= source) + { + set_string_field(conf, &conf->reset_val, newval); + conf->gen.reset_source = source; + } + for (stack = conf->gen.stack; stack; stack = stack->prev) + { + if (stack->source <= source) { - set_string_field(conf, &conf->reset_val, newval); - conf->gen.reset_source = source; + set_string_field(conf, &stack->prior.stringval, + newval); + stack->source = source; } - for (stack = conf->gen.stack; stack; stack = stack->prev) - { - if (stack->source <= source) - { - set_string_field(conf, &stack->prior.stringval, - newval); - stack->source = source; - } - } - /* Perhaps we didn't install newval anywhere */ - if (newval && !string_field_used(conf, newval)) - free(newval); } } - else if (newval) + /* Perhaps we didn't install newval anywhere */ + if (newval && !string_field_used(conf, newval)) free(newval); break; } @@ -4974,6 +4964,10 @@ set_config_option(const char *name, const char *value, source = conf->gen.reset_source; } + /* Save old value to support transaction abort */ + if (changeVal && !makeDefault) + push_old_value(&conf->gen, action); + if (conf->assign_hook) if (!(*conf->assign_hook) (newval, changeVal, source)) { @@ -4985,32 +4979,26 @@ set_config_option(const char *name, const char *value, return false; } - if (changeVal || makeDefault) + if (changeVal) { - /* Save old value to support transaction abort */ - if (!makeDefault) - push_old_value(&conf->gen, action); - if (changeVal) - { - *conf->variable = newval; - conf->gen.source = source; - } - if (makeDefault) - { - GucStack *stack; + *conf->variable = newval; + conf->gen.source = source; + } + if (makeDefault) + { + GucStack *stack; - if (conf->gen.reset_source <= source) + if (conf->gen.reset_source <= source) + { + conf->reset_val = newval; + conf->gen.reset_source = source; + } + for (stack = conf->gen.stack; stack; stack = stack->prev) + { + if (stack->source <= source) { - conf->reset_val = newval; - conf->gen.reset_source = source; - } - for (stack = conf->gen.stack; stack; stack = stack->prev) - { - if (stack->source <= source) - { - stack->prior.enumval = newval; - stack->source = source; - } + stack->prior.enumval = newval; + stack->source = source; } } }