From: Nathan Bossart <nathan@postgresql.org>
Subject: [PATCH v2 1/1] Allow resetting unknown custom GUCs with reserved prefixes.
Date: Wed, 25 Jun 2025 10:54:33 -0500
---
src/backend/utils/misc/guc.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.cindex 667df448732..a75960d2b0b 100644--- a/src/backend/utils/misc/guc.c+++ b/src/backend/utils/misc/guc.c@@ -6711,6 +6711,7 @@ validate_option_array_item(const char *name, const char *value,
{
struct config_generic *gconf;
+ bool reset_custom;
/*
* There are three cases to consider:
@@ -6729,16 +6730,28 @@ validate_option_array_item(const char *name, const char *value,
* it's assumed to be fully validated.)
*
* name is not known and can't be created as a placeholder. Throw error,
- * unless skipIfNoPermissions is true, in which case return false.+ * unless skipIfNoPermissions or reset_custom is true. If find_option()+ * returns false and reset_custom is true, this is a RESET or RESET ALL+ * operation for an unknown custom GUC with a reserved prefix, in which+ * case we want to fall through to the placeholder check described in the+ * preceding paragraph (else there'd be no way for users to remove them).+ * Otherwise, if find_option() returns false, return false here, too.
*/
- gconf = find_option(name, true, skipIfNoPermissions, ERROR);- if (!gconf)+ reset_custom = (!value && valid_custom_variable_name(name));+ gconf = find_option(name, true, skipIfNoPermissions || reset_custom, ERROR);+ if (!gconf && !reset_custom)
{
/* not known, failed to make a placeholder */
return false;
}
- if (gconf->flags & GUC_CUSTOM_PLACEHOLDER)+ /*+ * If we reach this point and gconf is NULL, we know we're dealing with a+ * RESET or RESET ALL command for an unknown custom GUC with a reserved+ * prefix. We treat that the same as if a placeholder was created, else+ * there'd be no way for users to remove them.+ */+ if (!gconf || gconf->flags & GUC_CUSTOM_PLACEHOLDER)
{
/*
* We cannot do any meaningful check on the value, so only permissions
--
2.39.5 (Apple Git-154)
--tHVdw3fiIHnjo3EY--
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: nathan@postgresql.org
Subject: Re: [PATCH v2 1/1] Allow resetting unknown custom GUCs with reserved prefixes.
In-Reply-To: <no-message-id-25352@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox