Skip to content

Commit 47ab1ac

Browse files
committed
Use hba_file/ident_file GUCs rather than pg_hba.conf/pg_ident.conf in logs
This is particularly useful when log_min_messages is set to FATAL, so as one can know which file was not getting loaded whether hba_file or ident_file are set to some non-default values. If using the default values of these GUC parameters, the same reports are generated. This commit changes the load (startup) and reload (SIGHUP) messages. Author: Julien Rouhaud Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud
1 parent 53823a0 commit 47ab1ac

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,8 @@ PostmasterMain(int argc, char *argv[])
14191419
* since there is no way to connect to the database in this case.
14201420
*/
14211421
ereport(FATAL,
1422-
(errmsg("could not load pg_hba.conf")));
1422+
/* translator: %s is a configuration file */
1423+
(errmsg("could not load %s", HbaFileName)));
14231424
}
14241425
if (!load_ident())
14251426
{
@@ -2769,11 +2770,11 @@ SIGHUP_handler(SIGNAL_ARGS)
27692770
if (!load_hba())
27702771
ereport(LOG,
27712772
/* translator: %s is a configuration file */
2772-
(errmsg("%s was not reloaded", "pg_hba.conf")));
2773+
(errmsg("%s was not reloaded", HbaFileName)));
27732774

27742775
if (!load_ident())
27752776
ereport(LOG,
2776-
(errmsg("%s was not reloaded", "pg_ident.conf")));
2777+
(errmsg("%s was not reloaded", IdentFileName)));
27772778

27782779
#ifdef USE_SSL
27792780
/* Reload SSL configuration as well */

src/backend/utils/init/postinit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ PerformAuthentication(Port *port)
217217
* since there is no way to connect to the database in this case.
218218
*/
219219
ereport(FATAL,
220-
(errmsg("could not load pg_hba.conf")));
220+
/* translator: %s is a configuration file */
221+
(errmsg("could not load %s", HbaFileName)));
221222
}
222223

223224
if (!load_ident())

0 commit comments

Comments
 (0)