Use hba_file/ident_file GUCs rather than pg_hba.conf/pg_ident.conf in logs
authorMichael Paquier
Fri, 5 Aug 2022 00:36:42 +0000 (09:36 +0900)
committerMichael Paquier
Fri, 5 Aug 2022 00:37:12 +0000 (09:37 +0900)
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

src/backend/postmaster/postmaster.c
src/backend/utils/init/postinit.c

index e541b16bdbe11916f6287e14e93803ee0e53baa0..81cb585891b9e02e2b103b7ff25be87255fb09c7 100644 (file)
@@ -1419,7 +1419,8 @@ PostmasterMain(int argc, char *argv[])
         * since there is no way to connect to the database in this case.
         */
        ereport(FATAL,
-               (errmsg("could not load pg_hba.conf")));
+       /* translator: %s is a configuration file */
+               (errmsg("could not load %s", HbaFileName)));
    }
    if (!load_ident())
    {
@@ -2769,11 +2770,11 @@ SIGHUP_handler(SIGNAL_ARGS)
        if (!load_hba())
            ereport(LOG,
            /* translator: %s is a configuration file */
-                   (errmsg("%s was not reloaded", "pg_hba.conf")));
+                   (errmsg("%s was not reloaded", HbaFileName)));
 
        if (!load_ident())
            ereport(LOG,
-                   (errmsg("%s was not reloaded", "pg_ident.conf")));
+                   (errmsg("%s was not reloaded", IdentFileName)));
 
 #ifdef USE_SSL
        /* Reload SSL configuration as well */
index 29f70accb22753c03078714480b02bc738ac3789..0d557a8684b58ac4f0c586a52cd55f4ff5cf1ddc 100644 (file)
@@ -217,7 +217,8 @@ PerformAuthentication(Port *port)
         * since there is no way to connect to the database in this case.
         */
        ereport(FATAL,
-               (errmsg("could not load pg_hba.conf")));
+       /* translator: %s is a configuration file */
+               (errmsg("could not load %s", HbaFileName)));
    }
 
    if (!load_ident())