Rename EmitWarningsOnPlaceholders() to MarkGUCPrefixReserved().

This seems like a clearer name for what it does now.

Provide a compatibility macro so that extensions don't have to convert
to the new name right away.

Discussion: https://postgr.es/m/116024.1640111629@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2021-12-27 14:39:08 -05:00
parent 2ed8a8cc5b
commit 5609cc01c6
15 changed files with 24 additions and 17 deletions

View File

@ -68,7 +68,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("auth_delay");
MarkGUCPrefixReserved("auth_delay");
/* Install Hooks */
original_client_auth_hook = ClientAuthentication_hook;

View File

@ -231,7 +231,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("auto_explain");
MarkGUCPrefixReserved("auto_explain");
/* Install hooks. */
prev_ExecutorStart = ExecutorStart_hook;

View File

@ -136,7 +136,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("pg_prewarm");
MarkGUCPrefixReserved("pg_prewarm");
RequestAddinShmemSpace(MAXALIGN(sizeof(AutoPrewarmSharedState)));

View File

@ -437,7 +437,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("pg_stat_statements");
MarkGUCPrefixReserved("pg_stat_statements");
/*
* Request additional shared resources. (These are no-ops if we're not in

View File

@ -101,7 +101,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("pg_trgm");
MarkGUCPrefixReserved("pg_trgm");
}
/*

View File

@ -532,5 +532,5 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("postgres_fdw");
MarkGUCPrefixReserved("postgres_fdw");
}

View File

@ -455,7 +455,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("sepgsql");
MarkGUCPrefixReserved("sepgsql");
/* Initialize userspace access vector cache */
sepgsql_avc_init();

View File

@ -9360,11 +9360,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
* GUCs, to help catch misspelled config-file entries,
* GUCs, to help catch misspelled config-file entries.
*/
void
EmitWarningsOnPlaceholders(const char *className)
MarkGUCPrefixReserved(const char *className)
{
int classLen = strlen(className);
int i;

View File

@ -354,7 +354,10 @@ extern void DefineCustomEnumVariable(const char *name,
GucEnumAssignHook assign_hook,
GucShowHook show_hook);
extern void EmitWarningsOnPlaceholders(const char *className);
extern void MarkGUCPrefixReserved(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,
bool restrict_privileged);

View File

@ -453,7 +453,7 @@ _PG_init(void)
PGC_SUSET, 0,
NULL, NULL, NULL);
EmitWarningsOnPlaceholders("plperl");
MarkGUCPrefixReserved("plperl");
/*
* Create hash tables.

View File

@ -197,7 +197,7 @@ _PG_init(void)
plpgsql_extra_errors_assign_hook,
NULL);
EmitWarningsOnPlaceholders("plpgsql");
MarkGUCPrefixReserved("plpgsql");
plpgsql_HashTableInit();
RegisterXactCallback(plpgsql_xact_cb, NULL);

View File

@ -474,8 +474,8 @@ _PG_init(void)
PGC_SUSET, 0,
NULL, NULL, NULL);
EmitWarningsOnPlaceholders("pltcl");
EmitWarningsOnPlaceholders("pltclu");
MarkGUCPrefixReserved("pltcl");
MarkGUCPrefixReserved("pltclu");
pltcl_pm_init_done = true;
}

View File

@ -91,7 +91,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("delay_execution");
MarkGUCPrefixReserved("delay_execution");
/* Install our hook */
prev_planner_hook = planner_hook;

View File

@ -49,7 +49,7 @@ _PG_init(void)
NULL,
NULL);
EmitWarningsOnPlaceholders("ssl_passphrase");
MarkGUCPrefixReserved("ssl_passphrase");
if (ssl_passphrase)
openssl_tls_init_hook = set_rot13;

View File

@ -322,7 +322,7 @@ _PG_init(void)
0,
NULL, NULL, NULL);
EmitWarningsOnPlaceholders("worker_spi");
MarkGUCPrefixReserved("worker_spi");
/* set up common data for all our workers */
memset(&worker, 0, sizeof(worker));