@@ -148,8 +148,6 @@ extern bool optimize_bounded_sort;
148
148
149
149
static int GUC_check_errcode_value ;
150
150
151
- static List * reserved_class_prefix = NIL ;
152
-
153
151
/* global variables for check hook support */
154
152
char * GUC_check_errmsg_string ;
155
153
char * GUC_check_errdetail_string ;
@@ -5569,44 +5567,18 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
5569
5567
* doesn't contain a separator, don't assume that it was meant to be a
5570
5568
* placeholder.
5571
5569
*/
5572
- const char * sep = strchr (name , GUC_QUALIFIER_SEPARATOR );
5573
-
5574
- if (sep != NULL )
5570
+ if (strchr (name , GUC_QUALIFIER_SEPARATOR ) != NULL )
5575
5571
{
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 ;
5610
5582
}
5611
5583
}
5612
5584
@@ -9360,21 +9332,15 @@ DefineCustomEnumVariable(const char *name,
9360
9332
}
9361
9333
9362
9334
/*
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.
9367
9335
* Extensions should call this after they've defined all of their custom
9368
9336
* GUCs, to help catch misspelled config-file entries.
9369
9337
*/
9370
9338
void
9371
- MarkGUCPrefixReserved (const char * className )
9339
+ EmitWarningsOnPlaceholders (const char * className )
9372
9340
{
9373
9341
int classLen = strlen (className );
9374
9342
int i ;
9375
- MemoryContext oldcontext ;
9376
9343
9377
- /* Check for existing placeholders. */
9378
9344
for (i = 0 ; i < num_guc_variables ; i ++ )
9379
9345
{
9380
9346
struct config_generic * var = guc_variables [i ];
@@ -9389,11 +9355,6 @@ MarkGUCPrefixReserved(const char *className)
9389
9355
var -> name )));
9390
9356
}
9391
9357
}
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 );
9397
9358
}
9398
9359
9399
9360
0 commit comments