diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-21 12:12:24 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-21 12:12:24 -0500 |
commit | 1fada5d81e6769ded832a4ca62ee9371bac3fb9f (patch) | |
tree | b645a3f7fc4340bcc0e6596309231c356a216d86 /src | |
parent | 0e6e7f0806b2080cb31f33ff992ec2e4e35fa6f1 (diff) | |
download | postgresql-1fada5d81e6769ded832a4ca62ee9371bac3fb9f.tar.gz |
Add missing EmitWarningsOnPlaceholders() calls.
Extensions that define any custom GUCs should call
EmitWarningsOnPlaceholders after doing so, to help catch misspellings.
Many of our contrib modules hadn't gotten the memo on that, though.
Also add such calls to src/test/modules extensions that have GUCs.
While these aren't really user-facing, they should illustrate good
practice not faulty practice.
Shinya Kato
Discussion: https://postgr.es/m/524fa2c0a34f34b68fbfa90d0760d515@oss.nttdata.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/misc/guc.c | 7 | ||||
-rw-r--r-- | src/pl/tcl/pltcl.c | 3 | ||||
-rw-r--r-- | src/test/modules/delay_execution/delay_execution.c | 2 | ||||
-rw-r--r-- | src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c | 3 | ||||
-rw-r--r-- | src/test/modules/worker_spi/worker_spi.c | 2 |
5 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 7b03046301..bff949a40b 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -9194,6 +9194,9 @@ reapply_stacked_values(struct config_generic *variable, } } +/* + * Functions for extensions to call to define their custom GUC variables. + */ void DefineCustomBoolVariable(const char *name, const char *short_desc, @@ -9333,6 +9336,10 @@ DefineCustomEnumVariable(const char *name, define_custom_variable(&var->gen); } +/* + * Extensions should call this after they've defined all of their custom + * GUCs, to help catch misspelled config-file entries, + */ void EmitWarningsOnPlaceholders(const char *className) { diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index e11837559d..7c045f4560 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -474,6 +474,9 @@ _PG_init(void) PGC_SUSET, 0, NULL, NULL, NULL); + EmitWarningsOnPlaceholders("pltcl"); + EmitWarningsOnPlaceholders("pltclu"); + pltcl_pm_init_done = true; } diff --git a/src/test/modules/delay_execution/delay_execution.c b/src/test/modules/delay_execution/delay_execution.c index b3d0841ba8..8ec623ac52 100644 --- a/src/test/modules/delay_execution/delay_execution.c +++ b/src/test/modules/delay_execution/delay_execution.c @@ -91,6 +91,8 @@ _PG_init(void) NULL, NULL); + EmitWarningsOnPlaceholders("delay_execution"); + /* Install our hook */ prev_planner_hook = planner_hook; planner_hook = delay_execution_planner; diff --git a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c index 6b0a3db104..3ba33e501c 100644 --- a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c +++ b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c @@ -48,6 +48,9 @@ _PG_init(void) NULL, NULL, NULL); + + EmitWarningsOnPlaceholders("ssl_passphrase"); + if (ssl_passphrase) openssl_tls_init_hook = set_rot13; } diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c index 0b6246676b..adb02d8cb8 100644 --- a/src/test/modules/worker_spi/worker_spi.c +++ b/src/test/modules/worker_spi/worker_spi.c @@ -322,6 +322,8 @@ _PG_init(void) 0, NULL, NULL, NULL); + EmitWarningsOnPlaceholders("worker_spi"); + /* set up common data for all our workers */ memset(&worker, 0, sizeof(worker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS | |