@@ -148,8 +148,6 @@ extern bool optimize_bounded_sort;
148148
149149static int GUC_check_errcode_value ;
150150
151- static List * reserved_class_prefix = NIL ;
152-
153151/* global variables for check hook support */
154152char * GUC_check_errmsg_string ;
155153char * GUC_check_errdetail_string ;
@@ -5569,44 +5567,18 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
55695567 * doesn't contain a separator, don't assume that it was meant to be a
55705568 * placeholder.
55715569 */
5572- const char * sep = strchr (name , GUC_QUALIFIER_SEPARATOR );
5573-
5574- if (sep != NULL )
5570+ if (strchr (name , GUC_QUALIFIER_SEPARATOR ) != NULL )
55755571 {
5576- size_t classLen = sep - name ;
5577- ListCell * lc ;
5578-
5579- /* The name must be syntactically acceptable ... */
5580- if (!valid_custom_variable_name (name ))
5581- {
5582- if (!skip_errors )
5583- ereport (elevel ,
5584- (errcode (ERRCODE_INVALID_NAME ),
5585- errmsg ("invalid configuration parameter name \"%s\"" ,
5586- name ),
5587- errdetail ("Custom parameter names must be two or more simple identifiers separated by dots." )));
5588- return NULL ;
5589- }
5590- /* ... and it must not match any previously-reserved prefix */
5591- foreach (lc , reserved_class_prefix )
5592- {
5593- const char * rcprefix = lfirst (lc );
5594-
5595- if (strlen (rcprefix ) == classLen &&
5596- strncmp (name , rcprefix , classLen ) == 0 )
5597- {
5598- if (!skip_errors )
5599- ereport (elevel ,
5600- (errcode (ERRCODE_INVALID_NAME ),
5601- errmsg ("invalid configuration parameter name \"%s\"" ,
5602- name ),
5603- errdetail ("\"%s\" is a reserved prefix." ,
5604- rcprefix )));
5605- return NULL ;
5606- }
5607- }
5608- /* OK, create it */
5609- return add_placeholder_variable (name , elevel );
5572+ if (valid_custom_variable_name (name ))
5573+ return add_placeholder_variable (name , elevel );
5574+ /* A special error message seems desirable here */
5575+ if (!skip_errors )
5576+ ereport (elevel ,
5577+ (errcode (ERRCODE_INVALID_NAME ),
5578+ errmsg ("invalid configuration parameter name \"%s\"" ,
5579+ name ),
5580+ errdetail ("Custom parameter names must be two or more simple identifiers separated by dots." )));
5581+ return NULL ;
56105582 }
56115583 }
56125584
@@ -9360,21 +9332,15 @@ DefineCustomEnumVariable(const char *name,
93609332}
93619333
93629334/*
9363- * Mark the given GUC prefix as "reserved".
9364- *
9365- * This prints warnings if there are any existing placeholders matching
9366- * the prefix, and then prevents new ones from being created.
93679335 * Extensions should call this after they've defined all of their custom
93689336 * GUCs, to help catch misspelled config-file entries.
93699337 */
93709338void
9371- MarkGUCPrefixReserved (const char * className )
9339+ EmitWarningsOnPlaceholders (const char * className )
93729340{
93739341 int classLen = strlen (className );
93749342 int i ;
9375- MemoryContext oldcontext ;
93769343
9377- /* Check for existing placeholders. */
93789344 for (i = 0 ; i < num_guc_variables ; i ++ )
93799345 {
93809346 struct config_generic * var = guc_variables [i ];
@@ -9389,11 +9355,6 @@ MarkGUCPrefixReserved(const char *className)
93899355 var -> name )));
93909356 }
93919357 }
9392-
9393- /* And remember the name so we can prevent future mistakes. */
9394- oldcontext = MemoryContextSwitchTo (TopMemoryContext );
9395- reserved_class_prefix = lappend (reserved_class_prefix , pstrdup (className ));
9396- MemoryContextSwitchTo (oldcontext );
93979358}
93989359
93999360
0 commit comments