Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcab5b9a

Browse files
committed
Revert changes about warnings/errors for placeholders.
Revert commits5609cc0,2ed8a8c, and75d2206 until we havea less broken idea of how this should work in parallel workers.Per buildfarm.Discussion:https://postgr.es/m/1640909.1640638123@sss.pgh.pa.us
1 parent5609cc0 commitcab5b9a

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
staticintGUC_check_errcode_value;
150150

151-
staticList*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-
constchar*sep=strchr(name,GUC_QUALIFIER_SEPARATOR);
5573-
5574-
if (sep!=NULL)
5570+
if (strchr(name,GUC_QUALIFIER_SEPARATOR)!=NULL)
55755571
{
5576-
size_tclassLen=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-
returnNULL;
5589-
}
5590-
/* ... and it must not match any previously-reserved prefix */
5591-
foreach(lc,reserved_class_prefix)
5592-
{
5593-
constchar*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-
returnNULL;
5606-
}
5607-
}
5608-
/* OK, create it */
5609-
returnadd_placeholder_variable(name,elevel);
5572+
if (valid_custom_variable_name(name))
5573+
returnadd_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+
returnNULL;
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(constchar*className)
9339+
EmitWarningsOnPlaceholders(constchar*className)
93729340
{
93739341
intclassLen=strlen(className);
93749342
inti;
9375-
MemoryContextoldcontext;
93769343

9377-
/* Check for existing placeholders. */
93789344
for (i=0;i<num_guc_variables;i++)
93799345
{
93809346
structconfig_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
GucEnumAssignHookassign_hook,
355355
GucShowHookshow_hook);
356356

357-
externvoidMarkGUCPrefixReserved(constchar*className);
358-
359-
/* old name for MarkGUCPrefixReserved, for backwards compatibility: */
360-
#defineEmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className)
357+
externvoidEmitWarningsOnPlaceholders(constchar*className);
361358

362359
externconstchar*GetConfigOption(constchar*name,boolmissing_ok,
363360
boolrestrict_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.

‎src/pl/plpgsql/src/pl_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ _PG_init(void)
197197
plpgsql_extra_errors_assign_hook,
198198
NULL);
199199

200-
MarkGUCPrefixReserved("plpgsql");
200+
EmitWarningsOnPlaceholders("plpgsql");
201201

202202
plpgsql_HashTableInit();
203203
RegisterXactCallback(plpgsql_xact_cb,NULL);

‎src/pl/tcl/pltcl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ _PG_init(void)
474474
PGC_SUSET,0,
475475
NULL,NULL,NULL);
476476

477-
MarkGUCPrefixReserved("pltcl");
478-
MarkGUCPrefixReserved("pltclu");
477+
EmitWarningsOnPlaceholders("pltcl");
478+
EmitWarningsOnPlaceholders("pltclu");
479479

480480
pltcl_pm_init_done= true;
481481
}

‎src/test/modules/delay_execution/delay_execution.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _PG_init(void)
9191
NULL,
9292
NULL);
9393

94-
MarkGUCPrefixReserved("delay_execution");
94+
EmitWarningsOnPlaceholders("delay_execution");
9595

9696
/* Install our hook */
9797
prev_planner_hook=planner_hook;

‎src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ _PG_init(void)
4949
NULL,
5050
NULL);
5151

52-
MarkGUCPrefixReserved("ssl_passphrase");
52+
EmitWarningsOnPlaceholders("ssl_passphrase");
5353

5454
if (ssl_passphrase)
5555
openssl_tls_init_hook=set_rot13;

‎src/test/modules/worker_spi/worker_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ _PG_init(void)
322322
0,
323323
NULL,NULL,NULL);
324324

325-
MarkGUCPrefixReserved("worker_spi");
325+
EmitWarningsOnPlaceholders("worker_spi");
326326

327327
/* set up common data for all our workers */
328328
memset(&worker,0,sizeof(worker));

‎src/test/regress/expected/guc.out

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -548,23 +548,6 @@ ERROR: invalid configuration parameter name "special.weird name"
548548
DETAIL: Custom parameter names must be two or more simple identifiers separated by dots.
549549
SHOW special."weird name";
550550
ERROR: unrecognized configuration parameter "special.weird name"
551-
-- Check what happens when you try to set a "custom" GUC within the
552-
-- namespace of an extension.
553-
SET plpgsql.bogus_setting = 42; -- allowed if plpgsql is not loaded yet
554-
LOAD 'plpgsql'; -- this will now warn about it
555-
WARNING: unrecognized configuration parameter "plpgsql.bogus_setting"
556-
SET plpgsql.extra_foo_warnings = false; -- but now, it's an error
557-
ERROR: invalid configuration parameter name "plpgsql.extra_foo_warnings"
558-
DETAIL: "plpgsql" is a reserved prefix.
559-
SHOW plpgsql.extra_foo_warnings;
560-
ERROR: unrecognized configuration parameter "plpgsql.extra_foo_warnings"
561-
SET plpgsql.bogus_setting = 43; -- you can still use the pre-existing variable
562-
SHOW plpgsql.bogus_setting;
563-
plpgsql.bogus_setting
564-
-----------------------
565-
43
566-
(1 row)
567-
568551
--
569552
-- Test DISCARD TEMP
570553
--

‎src/test/regress/sql/guc.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,6 @@ SHOW custom."bad-guc";
163163
SET special."weird name"='foo';-- could be allowed, but we choose not to
164164
SHOW special."weird name";
165165

166-
-- Check what happens when you try to set a "custom" GUC within the
167-
-- namespace of an extension.
168-
SETplpgsql.bogus_setting=42;-- allowed if plpgsql is not loaded yet
169-
LOAD'plpgsql';-- this will now warn about it
170-
SETplpgsql.extra_foo_warnings= false;-- but now, it's an error
171-
SHOWplpgsql.extra_foo_warnings;
172-
SETplpgsql.bogus_setting=43;-- you can still use the pre-existing variable
173-
SHOWplpgsql.bogus_setting;
174-
175166
--
176167
-- Test DISCARD TEMP
177168
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp