v1-fix-set_config_option-logic-bugs.patch
text/x-diff
Filename: v1-fix-set_config_option-logic-bugs.patch
Type: text/x-diff
Part: 0
Message:
Two small bugs in guc.c
Patch
Format: unified
Series: patch v1
| File | + | − |
|---|---|---|
| src/backend/utils/misc/guc.c | 7 | 2 |
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 959a1c76bf..4126b90ad7 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)
@@ -3513,7 +3516,9 @@ set_config_with_handle(const char *name, config_handle *handle,
* postmaster (whence it will propagate to
* subsequently-started backends), but ignore it in existing
* backends. This is a tad klugy, but necessary because we
- * don't re-read the config file during backend start.
+ * don't re-read the config file during backend start. Handle
+ * this by clearing changeVal but continuing, since we do want
+ * to report incorrect values.
*
* In EXEC_BACKEND builds, this works differently: we load all
* non-default settings from the CONFIG_EXEC_PARAMS file
@@ -3526,7 +3531,7 @@ set_config_with_handle(const char *name, config_handle *handle,
* applies.
*/
if (IsUnderPostmaster && !is_reload)
- return -1;
+ changeVal = false;
}
else if (context != PGC_POSTMASTER &&
context != PGC_BACKEND &&