index ca1e483d61a269a7b61568fc0a102ac4cd55c052..d11dd1e416e1939301aa881e04b49efb0dfc949b 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("auth_delay");
+ EmitWarningsOnPlaceholders("auth_delay");
/* Install Hooks */
original_client_auth_hook = ClientAuthentication_hook;
index a695fba0c5768586c8d07d38fdc235adb1c84047..59ba63455fd18ebf790f334c630d53fde41ee8b8 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("auto_explain");
+ EmitWarningsOnPlaceholders("auto_explain");
/* Install hooks. */
prev_ExecutorStart = ExecutorStart_hook;
index 8a2a90ad97b166b6e37e87af62303106d56068c2..0289ea657cb64dfc3ab74f5e2f43370a00257172 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("pg_prewarm");
+ EmitWarningsOnPlaceholders("pg_prewarm");
RequestAddinShmemSpace(MAXALIGN(sizeof(AutoPrewarmSharedState)));
index 8b2a8bbfe672138b50120602ccc7d1d460850436..726ba59e2bf48552db1d8d33cef1378750dd71d4 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("pg_stat_statements");
+ EmitWarningsOnPlaceholders("pg_stat_statements");
/*
* Request additional shared resources. (These are no-ops if we're not in
index e9b7981619fb630e7df636b29f4ea5f3700d47d1..0407c7dd64472e955c1f465d9f91730807ecd7d4 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("pg_trgm");
+ EmitWarningsOnPlaceholders("pg_trgm");
}
/*
index 194c81ef35b55b6af37bd7c28c970c9c11795d34..c2c4e36802c9a9bdbaed61fae6d655963c3a69f2 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("postgres_fdw");
+ EmitWarningsOnPlaceholders("postgres_fdw");
}
index c0d977d4fab4894a806d4adfd1da3a9da251067f..44a09c35a7c999417665a9dc517f9efe94f0916b 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("sepgsql");
+ EmitWarningsOnPlaceholders("sepgsql");
/* Initialize userspace access vector cache */
sepgsql_avc_init();
index d239004347963c81b657c1989a78c82140dd9130..f9504d3aec4fbacd4e600292383c20d030976bb6 100644 (file)
static int GUC_check_errcode_value;
-static List *reserved_class_prefix = NIL;
-
/* global variables for check hook support */
char *GUC_check_errmsg_string;
char *GUC_check_errdetail_string;
@@ -5569,44 +5567,18 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
* doesn't contain a separator, don't assume that it was meant to be a
* placeholder.
*/
- const char *sep = strchr(name, GUC_QUALIFIER_SEPARATOR);
-
- if (sep != NULL)
+ if (strchr(name, GUC_QUALIFIER_SEPARATOR) != NULL)
{
- size_t classLen = sep - name;
- ListCell *lc;
-
- /* The name must be syntactically acceptable ... */
- if (!valid_custom_variable_name(name))
- {
- if (!skip_errors)
- ereport(elevel,
- (errcode(ERRCODE_INVALID_NAME),
- errmsg("invalid configuration parameter name \"%s\"",
- name),
- errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
- return NULL;
- }
- /* ... and it must not match any previously-reserved prefix */
- foreach(lc, reserved_class_prefix)
- {
- const char *rcprefix = lfirst(lc);
-
- if (strlen(rcprefix) == classLen &&
- strncmp(name, rcprefix, classLen) == 0)
- {
- if (!skip_errors)
- ereport(elevel,
- (errcode(ERRCODE_INVALID_NAME),
- errmsg("invalid configuration parameter name \"%s\"",
- name),
- errdetail("\"%s\" is a reserved prefix.",
- rcprefix)));
- return NULL;
- }
- }
- /* OK, create it */
- return add_placeholder_variable(name, elevel);
+ if (valid_custom_variable_name(name))
+ return add_placeholder_variable(name, elevel);
+ /* A special error message seems desirable here */
+ if (!skip_errors)
+ ereport(elevel,
+ (errcode(ERRCODE_INVALID_NAME),
+ errmsg("invalid configuration parameter name \"%s\"",
+ name),
+ errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
+ return NULL;
}
}
}
/*
- * Mark the given GUC prefix as "reserved".
- *
- * This prints warnings if there are any existing placeholders matching
- * the prefix, and then prevents new ones from being created.
* Extensions should call this after they've defined all of their custom
* GUCs, to help catch misspelled config-file entries.
*/
void
-MarkGUCPrefixReserved(const char *className)
+EmitWarningsOnPlaceholders(const char *className)
{
int classLen = strlen(className);
int i;
- MemoryContext oldcontext;
- /* Check for existing placeholders. */
for (i = 0; i < num_guc_variables; i++)
{
struct config_generic *var = guc_variables[i];
var->name)));
}
}
-
- /* And remember the name so we can prevent future mistakes. */
- oldcontext = MemoryContextSwitchTo(TopMemoryContext);
- reserved_class_prefix = lappend(reserved_class_prefix, pstrdup(className));
- MemoryContextSwitchTo(oldcontext);
}
index 5ba95ced2c7f866cc530963fc5a9b19742169681..aa18d304ac03a7eebbdd1aba1a55495562f0c1a0 100644 (file)
@@ -354,10 +354,7 @@ extern void DefineCustomEnumVariable(const char *name,
GucEnumAssignHook assign_hook,
GucShowHook show_hook);
-extern void MarkGUCPrefixReserved(const char *className);
-
-/* old name for MarkGUCPrefixReserved, for backwards compatibility: */
-#define EmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className)
+extern void EmitWarningsOnPlaceholders(const char *className);
extern const char *GetConfigOption(const char *name, bool missing_ok,
bool restrict_privileged);
index 2497315e3b0e2144796c58c96a96b6ffb7848b77..1c77211ac45426984a1bba5a3b608ae6df78a3a1 100644 (file)
PGC_SUSET, 0,
NULL, NULL, NULL);
- MarkGUCPrefixReserved("plperl");
+ EmitWarningsOnPlaceholders("plperl");
/*
* Create hash tables.
index 55c39d208deb9a07723e71730779221c4088b392..00aace2f39fb32395564b1d995f3d1ff13b3cdd1 100644 (file)
plpgsql_extra_errors_assign_hook,
NULL);
- MarkGUCPrefixReserved("plpgsql");
+ EmitWarningsOnPlaceholders("plpgsql");
plpgsql_HashTableInit();
RegisterXactCallback(plpgsql_xact_cb, NULL);
index ab759833db11128cad4a2d84c849cbaa163bcd38..7c045f4560713af3491e11829cd1c7714649b7fc 100644 (file)
PGC_SUSET, 0,
NULL, NULL, NULL);
- MarkGUCPrefixReserved("pltcl");
- MarkGUCPrefixReserved("pltclu");
+ EmitWarningsOnPlaceholders("pltcl");
+ EmitWarningsOnPlaceholders("pltclu");
pltcl_pm_init_done = true;
}
index 25722d87ccc2bd1893fc53ca86b790855a44eb7c..8ec623ac52790ebb7fe225eeb671252a4c001895 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("delay_execution");
+ EmitWarningsOnPlaceholders("delay_execution");
/* Install our hook */
prev_planner_hook = planner_hook;
index 7c469fd57e885768429da403b9ecfcf8ed1096ef..3ba33e501c3c6fedd0b087584525d1af0b6d7b79 100644 (file)
NULL,
NULL);
- MarkGUCPrefixReserved("ssl_passphrase");
+ EmitWarningsOnPlaceholders("ssl_passphrase");
if (ssl_passphrase)
openssl_tls_init_hook = set_rot13;
index 3e9227aa8ae4162b1aba86f4144020a294f8508c..adb02d8cb83987b1147680cab060181e507c3189 100644 (file)
0,
NULL, NULL, NULL);
- MarkGUCPrefixReserved("worker_spi");
+ EmitWarningsOnPlaceholders("worker_spi");
/* set up common data for all our workers */
memset(&worker, 0, sizeof(worker));
index 5ad7477f618348b63547e9abc8cf9b8a2409cfb1..59da91ff04de6854dbc549e2d6b76ab0ac79f4c7 100644 (file)
@@ -548,23 +548,6 @@ ERROR: invalid configuration parameter name "special.weird name"
DETAIL: Custom parameter names must be two or more simple identifiers separated by dots.
SHOW special."weird name";
ERROR: unrecognized configuration parameter "special.weird name"
--- Check what happens when you try to set a "custom" GUC within the
--- namespace of an extension.
-SET plpgsql.bogus_setting = 42; -- allowed if plpgsql is not loaded yet
-LOAD 'plpgsql'; -- this will now warn about it
-WARNING: unrecognized configuration parameter "plpgsql.bogus_setting"
-SET plpgsql.extra_foo_warnings = false; -- but now, it's an error
-ERROR: invalid configuration parameter name "plpgsql.extra_foo_warnings"
-DETAIL: "plpgsql" is a reserved prefix.
-SHOW plpgsql.extra_foo_warnings;
-ERROR: unrecognized configuration parameter "plpgsql.extra_foo_warnings"
-SET plpgsql.bogus_setting = 43; -- you can still use the pre-existing variable
-SHOW plpgsql.bogus_setting;
- plpgsql.bogus_setting
------------------------
- 43
-(1 row)
-
--
-- Test DISCARD TEMP
--
index f97f4e44884bb4b2ac531c8fecb760cb6b40634c..c39c11388d51f9d54952107bfe1b44aa9a7bc378 100644 (file)
SET special."weird name" = 'foo'; -- could be allowed, but we choose not to
SHOW special."weird name";
--- Check what happens when you try to set a "custom" GUC within the
--- namespace of an extension.
-SET plpgsql.bogus_setting = 42; -- allowed if plpgsql is not loaded yet
-LOAD 'plpgsql'; -- this will now warn about it
-SET plpgsql.extra_foo_warnings = false; -- but now, it's an error
-SHOW plpgsql.extra_foo_warnings;
-SET plpgsql.bogus_setting = 43; -- you can still use the pre-existing variable
-SHOW plpgsql.bogus_setting;
-
--
-- Test DISCARD TEMP
--