Add missing EmitWarningsOnPlaceholders() calls.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Dec 2021 17:12:24 +0000 (12:12 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 21 Dec 2021 17:12:24 +0000 (12:12 -0500)
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

contrib/auth_delay/auth_delay.c
contrib/pg_trgm/trgm_op.c
contrib/postgres_fdw/option.c
contrib/sepgsql/hooks.c
src/backend/utils/misc/guc.c
src/pl/tcl/pltcl.c
src/test/modules/delay_execution/delay_execution.c
src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
src/test/modules/worker_spi/worker_spi.c

index 5820ac328db15ce431bc0a50185dc3c2cac9eeec..d11dd1e416e1939301aa881e04b49efb0dfc949b 100644 (file)
@@ -67,6 +67,9 @@ _PG_init(void)
                                                        NULL,
                                                        NULL,
                                                        NULL);
+
+       EmitWarningsOnPlaceholders("auth_delay");
+
        /* Install Hooks */
        original_client_auth_hook = ClientAuthentication_hook;
        ClientAuthentication_hook = auth_delay_checks;
index fb38135f7a3995f35212eca210688e06fbb11bf5..0407c7dd64472e955c1f465d9f91730807ecd7d4 100644 (file)
@@ -100,6 +100,8 @@ _PG_init(void)
                                                         NULL,
                                                         NULL,
                                                         NULL);
+
+       EmitWarningsOnPlaceholders("pg_trgm");
 }
 
 /*
index 48c7417e6ecbe528226b420d182dee5f374e6b5a..36555398ecb4afface6ffd0ac82cc6eed87ccaf6 100644 (file)
@@ -469,4 +469,6 @@ _PG_init(void)
                                                           NULL,
                                                           NULL,
                                                           NULL);
+
+       EmitWarningsOnPlaceholders("postgres_fdw");
 }
index 19a3ffb7ffae7ff550492b7257634b7ddffc7b46..44a09c35a7c999417665a9dc517f9efe94f0916b 100644 (file)
@@ -455,6 +455,8 @@ _PG_init(void)
                                                         NULL,
                                                         NULL);
 
+       EmitWarningsOnPlaceholders("sepgsql");
+
        /* Initialize userspace access vector cache */
        sepgsql_avc_init();
 
index 7b030463013c4b761f348ef18fce0f513be66848..bff949a40bc4a28f822c503fa6d9417de6a3dcf6 100644 (file)
@@ -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)
 {
index e11837559daa684de4add724ac32b989a80d93cf..7c045f4560713af3491e11829cd1c7714649b7fc 100644 (file)
@@ -474,6 +474,9 @@ _PG_init(void)
                                                           PGC_SUSET, 0,
                                                           NULL, NULL, NULL);
 
+       EmitWarningsOnPlaceholders("pltcl");
+       EmitWarningsOnPlaceholders("pltclu");
+
        pltcl_pm_init_done = true;
 }
 
index b3d0841ba809262016ba6f8b29bf5c4fa101b40e..8ec623ac52790ebb7fe225eeb671252a4c001895 100644 (file)
@@ -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;
index 6b0a3db104c2a21a11decd043700e29bb9750049..3ba33e501c3c6fedd0b087584525d1af0b6d7b79 100644 (file)
@@ -48,6 +48,9 @@ _PG_init(void)
                                                           NULL,
                                                           NULL,
                                                           NULL);
+
+       EmitWarningsOnPlaceholders("ssl_passphrase");
+
        if (ssl_passphrase)
                openssl_tls_init_hook = set_rot13;
 }
index 0b6246676b6ebc7f4768585b23ea3a498beda42e..adb02d8cb83987b1147680cab060181e507c3189 100644 (file)
@@ -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 |