diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 959a1c76bff..d929a179a86 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -3412,9 +3412,12 @@ set_config_with_handle(const char *name, config_handle *handle, * Other changes might need to affect other workers, so forbid them. */ if (IsInParallelMode() && changeVal && action != GUC_ACTION_SAVE) + { ereport(elevel, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), errmsg("cannot set parameters during a parallel operation"))); + return -1; + } /* if handle is specified, no need to look up option */ if (!handle) @@ -3515,6 +3518,10 @@ set_config_with_handle(const char *name, config_handle *handle, * backends. This is a tad klugy, but necessary because we * don't re-read the config file during backend start. * + * However, if changeVal is false then plow ahead anyway since + * we are trying to find out if the value is potentially good, + * not actually use it. + * * In EXEC_BACKEND builds, this works differently: we load all * non-default settings from the CONFIG_EXEC_PARAMS file * during backend start. In that case we must accept @@ -3525,7 +3532,7 @@ set_config_with_handle(const char *name, config_handle *handle, * started it. is_reload will be true when either situation * applies. */ - if (IsUnderPostmaster && !is_reload) + if (IsUnderPostmaster && changeVal && !is_reload) return -1; } else if (context != PGC_POSTMASTER &&