This is my first patch. I hope it's not stupid. We ran into a little issue today where permission/ownership on pg_hba.conf was accidentally changed to something that the postgres user could not read. When a SIGHUP was issued, the postmaster quit. That was kind of a bummer.
>From the comment in hba.c, it appears that the desired behavior is to have the system ignore the failure, and continue using what's already loaded into memory. And, turns out, that's what I would like Postgres to do as well. So, this patch changes the error issued from load_hba() from FATAL to WARNING if the file is not found, and returns. Startup behavior (FATAL if pg_hba.conf can't be found) is not changed. Tested against 8.4devel HEAD today. Patch attached. -- Selena Deckelmann End Point Corporation sel...@endpoint.com
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index a134b45..931ca86 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -1307,11 +1307,14 @@ load_hba(void) file = AllocateFile(HbaFileName, "r"); /* Failure is fatal since with no HBA entries we can do nothing... */ - if (file == NULL) - ereport(FATAL, + if (file == NULL) + { + ereport(WARNING, (errcode_for_file_access(), errmsg("could not open configuration file \"%s\": %m", HbaFileName))); + return false; + } tokenize_file(HbaFileName, file, &hba_lines, &hba_line_nums); FreeFile(file);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers