mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Revert changes about warnings/errors for placeholders.
Revert commits5609cc01c
,2ed8a8cc5
, and75d22069e
until we have a less broken idea of how this should work in parallel workers. Per buildfarm. Discussion: https://postgr.es/m/1640909.1640638123@sss.pgh.pa.us
This commit is contained in:
@ -68,7 +68,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("auth_delay");
|
EmitWarningsOnPlaceholders("auth_delay");
|
||||||
|
|
||||||
/* Install Hooks */
|
/* Install Hooks */
|
||||||
original_client_auth_hook = ClientAuthentication_hook;
|
original_client_auth_hook = ClientAuthentication_hook;
|
||||||
|
@ -231,7 +231,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("auto_explain");
|
EmitWarningsOnPlaceholders("auto_explain");
|
||||||
|
|
||||||
/* Install hooks. */
|
/* Install hooks. */
|
||||||
prev_ExecutorStart = ExecutorStart_hook;
|
prev_ExecutorStart = ExecutorStart_hook;
|
||||||
|
@ -136,7 +136,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("pg_prewarm");
|
EmitWarningsOnPlaceholders("pg_prewarm");
|
||||||
|
|
||||||
RequestAddinShmemSpace(MAXALIGN(sizeof(AutoPrewarmSharedState)));
|
RequestAddinShmemSpace(MAXALIGN(sizeof(AutoPrewarmSharedState)));
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("pg_stat_statements");
|
EmitWarningsOnPlaceholders("pg_stat_statements");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Request additional shared resources. (These are no-ops if we're not in
|
* Request additional shared resources. (These are no-ops if we're not in
|
||||||
|
@ -101,7 +101,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("pg_trgm");
|
EmitWarningsOnPlaceholders("pg_trgm");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -532,5 +532,5 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("postgres_fdw");
|
EmitWarningsOnPlaceholders("postgres_fdw");
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("sepgsql");
|
EmitWarningsOnPlaceholders("sepgsql");
|
||||||
|
|
||||||
/* Initialize userspace access vector cache */
|
/* Initialize userspace access vector cache */
|
||||||
sepgsql_avc_init();
|
sepgsql_avc_init();
|
||||||
|
@ -148,8 +148,6 @@ extern bool optimize_bounded_sort;
|
|||||||
|
|
||||||
static int GUC_check_errcode_value;
|
static int GUC_check_errcode_value;
|
||||||
|
|
||||||
static List *reserved_class_prefix = NIL;
|
|
||||||
|
|
||||||
/* global variables for check hook support */
|
/* global variables for check hook support */
|
||||||
char *GUC_check_errmsg_string;
|
char *GUC_check_errmsg_string;
|
||||||
char *GUC_check_errdetail_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
|
* doesn't contain a separator, don't assume that it was meant to be a
|
||||||
* placeholder.
|
* placeholder.
|
||||||
*/
|
*/
|
||||||
const char *sep = strchr(name, GUC_QUALIFIER_SEPARATOR);
|
if (strchr(name, GUC_QUALIFIER_SEPARATOR) != NULL)
|
||||||
|
|
||||||
if (sep != NULL)
|
|
||||||
{
|
{
|
||||||
size_t classLen = sep - name;
|
if (valid_custom_variable_name(name))
|
||||||
ListCell *lc;
|
return add_placeholder_variable(name, elevel);
|
||||||
|
/* A special error message seems desirable here */
|
||||||
/* The name must be syntactically acceptable ... */
|
if (!skip_errors)
|
||||||
if (!valid_custom_variable_name(name))
|
ereport(elevel,
|
||||||
{
|
(errcode(ERRCODE_INVALID_NAME),
|
||||||
if (!skip_errors)
|
errmsg("invalid configuration parameter name \"%s\"",
|
||||||
ereport(elevel,
|
name),
|
||||||
(errcode(ERRCODE_INVALID_NAME),
|
errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
|
||||||
errmsg("invalid configuration parameter name \"%s\"",
|
return NULL;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9360,21 +9332,15 @@ DefineCustomEnumVariable(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
* Extensions should call this after they've defined all of their custom
|
||||||
* GUCs, to help catch misspelled config-file entries.
|
* GUCs, to help catch misspelled config-file entries.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
MarkGUCPrefixReserved(const char *className)
|
EmitWarningsOnPlaceholders(const char *className)
|
||||||
{
|
{
|
||||||
int classLen = strlen(className);
|
int classLen = strlen(className);
|
||||||
int i;
|
int i;
|
||||||
MemoryContext oldcontext;
|
|
||||||
|
|
||||||
/* Check for existing placeholders. */
|
|
||||||
for (i = 0; i < num_guc_variables; i++)
|
for (i = 0; i < num_guc_variables; i++)
|
||||||
{
|
{
|
||||||
struct config_generic *var = guc_variables[i];
|
struct config_generic *var = guc_variables[i];
|
||||||
@ -9389,11 +9355,6 @@ MarkGUCPrefixReserved(const char *className)
|
|||||||
var->name)));
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,10 +354,7 @@ extern void DefineCustomEnumVariable(const char *name,
|
|||||||
GucEnumAssignHook assign_hook,
|
GucEnumAssignHook assign_hook,
|
||||||
GucShowHook show_hook);
|
GucShowHook show_hook);
|
||||||
|
|
||||||
extern void MarkGUCPrefixReserved(const char *className);
|
extern void EmitWarningsOnPlaceholders(const char *className);
|
||||||
|
|
||||||
/* old name for MarkGUCPrefixReserved, for backwards compatibility: */
|
|
||||||
#define EmitWarningsOnPlaceholders(className) MarkGUCPrefixReserved(className)
|
|
||||||
|
|
||||||
extern const char *GetConfigOption(const char *name, bool missing_ok,
|
extern const char *GetConfigOption(const char *name, bool missing_ok,
|
||||||
bool restrict_privileged);
|
bool restrict_privileged);
|
||||||
|
@ -453,7 +453,7 @@ _PG_init(void)
|
|||||||
PGC_SUSET, 0,
|
PGC_SUSET, 0,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("plperl");
|
EmitWarningsOnPlaceholders("plperl");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create hash tables.
|
* Create hash tables.
|
||||||
|
@ -197,7 +197,7 @@ _PG_init(void)
|
|||||||
plpgsql_extra_errors_assign_hook,
|
plpgsql_extra_errors_assign_hook,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("plpgsql");
|
EmitWarningsOnPlaceholders("plpgsql");
|
||||||
|
|
||||||
plpgsql_HashTableInit();
|
plpgsql_HashTableInit();
|
||||||
RegisterXactCallback(plpgsql_xact_cb, NULL);
|
RegisterXactCallback(plpgsql_xact_cb, NULL);
|
||||||
|
@ -474,8 +474,8 @@ _PG_init(void)
|
|||||||
PGC_SUSET, 0,
|
PGC_SUSET, 0,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("pltcl");
|
EmitWarningsOnPlaceholders("pltcl");
|
||||||
MarkGUCPrefixReserved("pltclu");
|
EmitWarningsOnPlaceholders("pltclu");
|
||||||
|
|
||||||
pltcl_pm_init_done = true;
|
pltcl_pm_init_done = true;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("delay_execution");
|
EmitWarningsOnPlaceholders("delay_execution");
|
||||||
|
|
||||||
/* Install our hook */
|
/* Install our hook */
|
||||||
prev_planner_hook = planner_hook;
|
prev_planner_hook = planner_hook;
|
||||||
|
@ -49,7 +49,7 @@ _PG_init(void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("ssl_passphrase");
|
EmitWarningsOnPlaceholders("ssl_passphrase");
|
||||||
|
|
||||||
if (ssl_passphrase)
|
if (ssl_passphrase)
|
||||||
openssl_tls_init_hook = set_rot13;
|
openssl_tls_init_hook = set_rot13;
|
||||||
|
@ -322,7 +322,7 @@ _PG_init(void)
|
|||||||
0,
|
0,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
MarkGUCPrefixReserved("worker_spi");
|
EmitWarningsOnPlaceholders("worker_spi");
|
||||||
|
|
||||||
/* set up common data for all our workers */
|
/* set up common data for all our workers */
|
||||||
memset(&worker, 0, sizeof(worker));
|
memset(&worker, 0, sizeof(worker));
|
||||||
|
@ -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.
|
DETAIL: Custom parameter names must be two or more simple identifiers separated by dots.
|
||||||
SHOW special."weird name";
|
SHOW special."weird name";
|
||||||
ERROR: unrecognized configuration parameter "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
|
-- Test DISCARD TEMP
|
||||||
--
|
--
|
||||||
|
@ -163,15 +163,6 @@ SHOW custom."bad-guc";
|
|||||||
SET special."weird name" = 'foo'; -- could be allowed, but we choose not to
|
SET special."weird name" = 'foo'; -- could be allowed, but we choose not to
|
||||||
SHOW special."weird name";
|
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
|
-- Test DISCARD TEMP
|
||||||
--
|
--
|
||||||
|
Reference in New Issue
Block a user