1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Change first call of ProcessConfigFile so as to process only data_directory.

When both postgresql.conf and postgresql.auto.conf have their own entry of
the same parameter, PostgreSQL uses the entry in postgresql.auto.conf because
it appears last in the configuration scan. IOW, the other entries which appear
earlier are ignored. But, previously, ProcessConfigFile() detected the invalid
settings of even those unused entries and emitted the error messages
complaining about them, at postmaster startup. Complaining about the entries
to ignore is basically useless.

This problem happened because ProcessConfigFile() was called twice at
postmaster startup and the first call read only postgresql.conf. That is, the
first call could check the entry which might be ignored eventually by
the second call which read both postgresql.conf and postgresql.auto.conf.
To work around the problem, this commit changes ProcessConfigFile so that
its first call processes only data_directory and the second one does all the
entries. It's OK to process data_directory in the first call because it's
ensured that data_directory doesn't exist in postgresql.auto.conf.

Back-patch to 9.4 where postgresql.auto.conf was added.

Patch by me. Review by Amit Kapila
This commit is contained in:
Fujii Masao
2014-08-12 16:50:09 +09:00
parent e15c4ab5fb
commit 3e3f65973a
2 changed files with 85 additions and 12 deletions

View File

@ -4339,6 +4339,13 @@ SelectConfigFiles(const char *userDoption, const char *progname)
return false;
}
/*
* Read the configuration file for the first time. This time only
* data_directory parameter is picked up to determine the data directory
* so that we can read PG_AUTOCONF_FILENAME file next time. Then don't
* forget to read the configuration file again later to pick up all the
* parameters.
*/
ProcessConfigFile(PGC_POSTMASTER);
/*