summaryrefslogtreecommitdiff
path: root/src/backend/commands/extension.c
diff options
context:
space:
mode:
authorTom Lane2011-10-04 23:57:21 +0000
committerTom Lane2011-10-04 23:57:21 +0000
commit41e461d36fb1ef78494429f28ea4b72c759f419d (patch)
tree42fd260b4b95417a452b4e76ff4831ea44a65b89 /src/backend/commands/extension.c
parentfa56a0c3e01c175695e932e6cdc2c6915df5adc6 (diff)
Improve define_custom_variable's handling of pre-existing settings.
Arrange for any problems with pre-existing settings to be reported as WARNING not ERROR, so that we don't undesirably abort the loading of the incoming add-on module. The bad setting is just discarded, as though it had never been applied at all. (This requires a change in the API of set_config_option. After some thought I decided the most potentially useful addition was to allow callers to just pass in a desired elevel.) Arrange to restore the complete stacked state of the variable, rather than cheesily reinstalling only the active value. This ensures that custom GUCs will behave unsurprisingly even when the module loading operation occurs within nested subtransactions that have changed the active value. Since a module load could occur as a result of, eg, a PL function call, this is not an unlikely scenario.
Diffstat (limited to 'src/backend/commands/extension.c')
-rw-r--r--src/backend/commands/extension.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 5ebc7553bc7..5da5981726c 100644
--- a/src/backend/commands/extension.c
+++ b/src/backend/commands/extension.c
@@ -816,14 +816,14 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
if (client_min_messages < WARNING)
(void) set_config_option("client_min_messages", "warning",
PGC_USERSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
save_log_min_messages =
pstrdup(GetConfigOption("log_min_messages", false, false));
if (log_min_messages < WARNING)
(void) set_config_option("log_min_messages", "warning",
PGC_SUSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
/*
* Set up the search path to contain the target schema, then the schemas
@@ -849,7 +849,7 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
(void) set_config_option("search_path", pathbuf.data,
PGC_USERSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
/*
* Set creating_extension and related variables so that
@@ -915,13 +915,13 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
*/
(void) set_config_option("search_path", save_search_path,
PGC_USERSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
(void) set_config_option("client_min_messages", save_client_min_messages,
PGC_USERSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
(void) set_config_option("log_min_messages", save_log_min_messages,
PGC_SUSET, PGC_S_SESSION,
- GUC_ACTION_LOCAL, true);
+ GUC_ACTION_LOCAL, true, 0);
}
/*