*** pgsql/src/backend/utils/misc/guc.c 2008/11/19 01:10:23 1.478 --- pgsql/src/backend/utils/misc/guc.c 2008/11/19 02:07:07 1.479 *************** *** 10,16 **** * Written by Peter Eisentraut . * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.477 2008/11/11 02:42:32 tgl Exp $ * *-------------------------------------------------------------------- */ --- 10,16 ---- * Written by Peter Eisentraut . * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.478 2008/11/19 01:10:23 tgl Exp $ * *-------------------------------------------------------------------- */ *************** define_custom_variable(struct config_gen *** 5657,5662 **** --- 5657,5663 ---- const char **nameAddr = &name; const char *value; struct config_string *pHolder; + GucContext phcontext; struct config_generic **res; /* *************** define_custom_variable(struct config_gen *** 5703,5708 **** --- 5704,5731 ---- *res = variable; /* + * Infer context for assignment based on source of existing value. + * We can't tell this with exact accuracy, but we can at least do + * something reasonable in typical cases. + */ + switch (pHolder->gen.source) + { + case PGC_S_DEFAULT: + case PGC_S_ENV_VAR: + case PGC_S_FILE: + case PGC_S_ARGV: + phcontext = PGC_SIGHUP; + break; + case PGC_S_DATABASE: + case PGC_S_USER: + case PGC_S_CLIENT: + case PGC_S_SESSION: + default: + phcontext = PGC_USERSET; + break; + } + + /* * Assign the string value stored in the placeholder to the real variable. * * XXX this is not really good enough --- it should be a nontransactional *************** define_custom_variable(struct config_gen *** 5713,5719 **** if (value) set_config_option(name, value, ! pHolder->gen.context, pHolder->gen.source, GUC_ACTION_SET, true); /* --- 5736,5742 ---- if (value) set_config_option(name, value, ! phcontext, pHolder->gen.source, GUC_ACTION_SET, true); /*