*
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.432 2008/01/30 18:35:55 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.432.2.1 2008/05/26 18:54:36 tgl Exp $
  *
  *--------------------------------------------------------------------
  */
                    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))
                    {
                        return false;
                    }
 
-               if (changeVal || makeDefault)
+               if (changeVal)
+               {
+                   *conf->variable = newval;
+                   conf->gen.source = source;
+               }
+               if (makeDefault)
                {
-                   /* Save old value to support transaction abort */
-                   if (!makeDefault)
-                       push_old_value(&conf->gen, action);
-                   if (changeVal)
+                   GucStack   *stack;
+
+                   if (conf->gen.reset_source <= source)
                    {
-                       *conf->variable = newval;
-                       conf->gen.source = source;
+                       conf->reset_val = newval;
+                       conf->gen.reset_source = source;
                    }
-                   if (makeDefault)
+                   for (stack = conf->gen.stack; stack; stack = stack->prev)
                    {
-                       GucStack   *stack;
-
-                       if (conf->gen.reset_source <= source)
+                       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;
                        }
                    }
                }
                    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))
                    {
                        return false;
                    }
 
-               if (changeVal || makeDefault)
+               if (changeVal)
+               {
+                   *conf->variable = newval;
+                   conf->gen.source = source;
+               }
+               if (makeDefault)
                {
-                   /* Save old value to support transaction abort */
-                   if (!makeDefault)
-                       push_old_value(&conf->gen, action);
-                   if (changeVal)
+                   GucStack   *stack;
+
+                   if (conf->gen.reset_source <= source)
                    {
-                       *conf->variable = newval;
-                       conf->gen.source = source;
+                       conf->reset_val = newval;
+                       conf->gen.reset_source = source;
                    }
-                   if (makeDefault)
+                   for (stack = conf->gen.stack; stack; stack = stack->prev)
                    {
-                       GucStack   *stack;
-
-                       if (conf->gen.reset_source <= source)
+                       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;
                        }
                    }
                }
                    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))
                    {
                        return false;
                    }
 
-               if (changeVal || makeDefault)
+               if (changeVal)
+               {
+                   *conf->variable = newval;
+                   conf->gen.source = source;
+               }
+               if (makeDefault)
                {
-                   /* Save old value to support transaction abort */
-                   if (!makeDefault)
-                       push_old_value(&conf->gen, action);
-                   if (changeVal)
+                   GucStack   *stack;
+
+                   if (conf->gen.reset_source <= source)
                    {
-                       *conf->variable = newval;
-                       conf->gen.source = source;
+                       conf->reset_val = newval;
+                       conf->gen.reset_source = source;
                    }
-                   if (makeDefault)
+                   for (stack = conf->gen.stack; stack; stack = stack->prev)
                    {
-                       GucStack   *stack;
-
-                       if (conf->gen.reset_source <= source)
+                       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;
                        }
                    }
                }
                    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;
                    }
                }
 
-               if (changeVal || makeDefault)
+               if (changeVal)
+               {
+                   set_string_field(conf, conf->variable, newval);
+                   conf->gen.source = source;
+               }
+               if (makeDefault)
                {
-                   /* Save old value to support transaction abort */
-                   if (!makeDefault)
-                       push_old_value(&conf->gen, action);
-                   if (changeVal)
+                   GucStack   *stack;
+
+                   if (conf->gen.reset_source <= source)
                    {
-                       set_string_field(conf, conf->variable, newval);
-                       conf->gen.source = source;
+                       set_string_field(conf, &conf->reset_val, newval);
+                       conf->gen.reset_source = source;
                    }
-                   if (makeDefault)
+                   for (stack = conf->gen.stack; stack; stack = stack->prev)
                    {
-                       GucStack   *stack;
-
-                       if (conf->gen.reset_source <= source)
+                       if (stack->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, &stack->prior.stringval,
-                                                newval);
-                               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;
            }