summaryrefslogtreecommitdiff
path: root/src/include/utils/guc.h
diff options
context:
space:
mode:
authorTom Lane2024-08-10 19:51:28 +0000
committerTom Lane2024-08-10 19:51:30 +0000
commit364de74cff281e7363c7ca8de4fbf04c6e16f8ed (patch)
treec74dc2df7839c065bf3238608aa40606dc4666ea /src/include/utils/guc.h
parent0868d7ae70e57f4eeba43792db92ce2d9fe4340d (diff)
Allow adjusting session_authorization and role in parallel workers.
The code intends to allow GUCs to be set within parallel workers via function SET clauses, but not otherwise. However, doing so fails for "session_authorization" and "role", because the assign hooks for those attempt to set the subsidiary "is_superuser" GUC, and that call falls foul of the "not otherwise" prohibition. We can't switch to using GUC_ACTION_SAVE for this, so instead add a new GUC variable flag GUC_ALLOW_IN_PARALLEL to mark is_superuser as being safe to set anyway. (This is okay because is_superuser has context PGC_INTERNAL and thus only hard-wired calls can change it. We'd need more thought before applying the flag to other GUCs; but maybe there are other use-cases.) This isn't the prettiest fix perhaps, but other alternatives we thought of would be much more invasive. While here, correct a thinko in commit 059de3ca4: when rejecting a GUC setting within a parallel worker, we should return 0 not -1 if the ereport doesn't longjmp. (This seems to have no consequences right now because no caller cares, but it's inconsistent.) Improve the comments to try to forestall future confusion of the same kind. Despite the lack of field complaints, this seems worth back-patching. Thanks to Nathan Bossart for the idea to invent a new flag, and for review. Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/include/utils/guc.h')
-rw-r--r--src/include/utils/guc.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 4129ea37eec..ba6883ae8fc 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -223,6 +223,7 @@ typedef enum
#define GUC_DISALLOW_IN_AUTO_FILE \
0x002000 /* can't set in PG_AUTOCONF_FILENAME */
#define GUC_RUNTIME_COMPUTED 0x004000 /* delay processing in 'postgres -C' */
+#define GUC_ALLOW_IN_PARALLEL 0x008000 /* allow setting in parallel mode */
#define GUC_UNIT_KB 0x01000000 /* value is in kilobytes */
#define GUC_UNIT_BLOCKS 0x02000000 /* value is in blocks */