Skip to content

Commit 1fada5d

Browse files
committed
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
1 parent 0e6e7f0 commit 1fada5d

File tree

9 files changed

+26
-0
lines changed

9 files changed

+26
-0
lines changed

contrib/auth_delay/auth_delay.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ _PG_init(void)
6767
NULL,
6868
NULL,
6969
NULL);
70+
71+
EmitWarningsOnPlaceholders("auth_delay");
72+
7073
/* Install Hooks */
7174
original_client_auth_hook = ClientAuthentication_hook;
7275
ClientAuthentication_hook = auth_delay_checks;

contrib/pg_trgm/trgm_op.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ _PG_init(void)
100100
NULL,
101101
NULL,
102102
NULL);
103+
104+
EmitWarningsOnPlaceholders("pg_trgm");
103105
}
104106

105107
/*

contrib/postgres_fdw/option.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,6 @@ _PG_init(void)
469469
NULL,
470470
NULL,
471471
NULL);
472+
473+
EmitWarningsOnPlaceholders("postgres_fdw");
472474
}

contrib/sepgsql/hooks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ _PG_init(void)
455455
NULL,
456456
NULL);
457457

458+
EmitWarningsOnPlaceholders("sepgsql");
459+
458460
/* Initialize userspace access vector cache */
459461
sepgsql_avc_init();
460462

src/backend/utils/misc/guc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9194,6 +9194,9 @@ reapply_stacked_values(struct config_generic *variable,
91949194
}
91959195
}
91969196

9197+
/*
9198+
* Functions for extensions to call to define their custom GUC variables.
9199+
*/
91979200
void
91989201
DefineCustomBoolVariable(const char *name,
91999202
const char *short_desc,
@@ -9333,6 +9336,10 @@ DefineCustomEnumVariable(const char *name,
93339336
define_custom_variable(&var->gen);
93349337
}
93359338

9339+
/*
9340+
* Extensions should call this after they've defined all of their custom
9341+
* GUCs, to help catch misspelled config-file entries,
9342+
*/
93369343
void
93379344
EmitWarningsOnPlaceholders(const char *className)
93389345
{

src/pl/tcl/pltcl.c

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

477+
EmitWarningsOnPlaceholders("pltcl");
478+
EmitWarningsOnPlaceholders("pltclu");
479+
477480
pltcl_pm_init_done = true;
478481
}
479482

src/test/modules/delay_execution/delay_execution.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ _PG_init(void)
9191
NULL,
9292
NULL);
9393

94+
EmitWarningsOnPlaceholders("delay_execution");
95+
9496
/* Install our hook */
9597
prev_planner_hook = planner_hook;
9698
planner_hook = delay_execution_planner;

src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ _PG_init(void)
4848
NULL,
4949
NULL,
5050
NULL);
51+
52+
EmitWarningsOnPlaceholders("ssl_passphrase");
53+
5154
if (ssl_passphrase)
5255
openssl_tls_init_hook = set_rot13;
5356
}

src/test/modules/worker_spi/worker_spi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ _PG_init(void)
322322
0,
323323
NULL, NULL, NULL);
324324

325+
EmitWarningsOnPlaceholders("worker_spi");
326+
325327
/* set up common data for all our workers */
326328
memset(&worker, 0, sizeof(worker));
327329
worker.bgw_flags = BGWORKER_SHMEM_ACCESS |

0 commit comments

Comments
 (0)