Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cab5b9a

Browse files
committed
Revert changes about warnings/errors for placeholders.
Revert commits 5609cc0, 2ed8a8c, and 75d2206 until we have a less broken idea of how this should work in parallel workers. Per buildfarm. Discussion: https://postgr.es/m/[email protected]
1 parent 5609cc0 commit cab5b9a

File tree

17 files changed

+27
-95
lines changed

17 files changed

+27
-95
lines changed

contrib/auth_delay/auth_delay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ _PG_init(void)
6868
NULL,
6969
NULL);
7070

71-
MarkGUCPrefixReserved("auth_delay");
71+
EmitWarningsOnPlaceholders("auth_delay");
7272

7373
/* Install Hooks */
7474
original_client_auth_hook = ClientAuthentication_hook;

contrib/auto_explain/auto_explain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ _PG_init(void)
231231
NULL,
232232
NULL);
233233

234-
MarkGUCPrefixReserved("auto_explain");
234+
EmitWarningsOnPlaceholders("auto_explain");
235235

236236
/* Install hooks. */
237237
prev_ExecutorStart = ExecutorStart_hook;

contrib/pg_prewarm/autoprewarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ _PG_init(void)
136136
NULL,
137137
NULL);
138138

139-
MarkGUCPrefixReserved("pg_prewarm");
139+
EmitWarningsOnPlaceholders("pg_prewarm");
140140

141141
RequestAddinShmemSpace(MAXALIGN(sizeof(AutoPrewarmSharedState)));
142142

contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ _PG_init(void)
437437
NULL,
438438
NULL);
439439

440-
MarkGUCPrefixReserved("pg_stat_statements");
440+
EmitWarningsOnPlaceholders("pg_stat_statements");
441441

442442
/*
443443
* Request additional shared resources. (These are no-ops if we're not in

contrib/pg_trgm/trgm_op.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ _PG_init(void)
101101
NULL,
102102
NULL);
103103

104-
MarkGUCPrefixReserved("pg_trgm");
104+
EmitWarningsOnPlaceholders("pg_trgm");
105105
}
106106

107107
/*

contrib/postgres_fdw/option.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,5 +532,5 @@ _PG_init(void)
532532
NULL,
533533
NULL);
534534

535-
MarkGUCPrefixReserved("postgres_fdw");
535+
EmitWarningsOnPlaceholders("postgres_fdw");
536536
}

contrib/sepgsql/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ _PG_init(void)
455455
NULL,
456456
NULL);
457457

458-
MarkGUCPrefixReserved("sepgsql");
458+
EmitWarningsOnPlaceholders("sepgsql");
459459

460460
/* Initialize userspace access vector cache */
461461
sepgsql_avc_init();

src/backend/utils/misc/guc.c

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ extern bool optimize_bounded_sort;
148148

149149
static int GUC_check_errcode_value;
150150

151-
static List *reserved_class_prefix = NIL;
152-
153151
/* global variables for check hook support */
154152
char *GUC_check_errmsg_string;
155153
char *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
*/
93709338
void
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

src/include/utils/guc.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,7 @@ extern void DefineCustomEnumVariable(const char *name,
354354
GucEnumAssignHook assign_hook,
355355
GucShowHook show_hook);
356356

357-
extern void MarkGUCPrefixReserved(const char *className);
358-
359-
/* old name for MarkGUCPrefixReserved, for backwards compatibility: */
360-
#define EmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className)
357+
extern void EmitWarningsOnPlaceholders(const char *className);
361358

362359
extern const char *GetConfigOption(const char *name, bool missing_ok,
363360
bool restrict_privileged);

src/pl/plperl/plperl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ _PG_init(void)
453453
PGC_SUSET, 0,
454454
NULL, NULL, NULL);
455455

456-
MarkGUCPrefixReserved("plperl");
456+
EmitWarningsOnPlaceholders("plperl");
457457

458458
/*
459459
* Create hash tables.

0 commit comments

Comments
 (0)