Change ParseConfigFp() so that it doesn't process unused entry of each parameter.
authorFujii Masao <fujii@postgresql.org>
Wed, 6 Aug 2014 05:49:43 +0000 (14:49 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 6 Aug 2014 05:49:43 +0000 (14:49 +0900)
commite3da0d4d1a47e2049ae16aa30bb7bf3105dc8c45
treef048ba7aa9b30177f386f6115969c537bb9e3491
parent49d1e03d64f36a345c92901c4d13bf683f99eeec
Change ParseConfigFp() so that it doesn't process unused entry of each parameter.

When more than one setting entries of same parameter exist in the
configuration file, PostgreSQL uses only entry appearing last in
configuration file scan. Since the other entries are not used,
ParseConfigFp() doesn't need to process them, but previously it did
that. This problematic behavior caused the configuration file scan
to detect invalid settings of unused entries (e.g., existence of
multiple entries of PGC_POSTMASTER parameter) and log the messages
complaining about them.

This commit changes the configuration file scan so that it processes
only last entry of each parameter.

Note that when multiple entries of same parameter exist both in
postgresql.conf and postgresql.auto.conf, unused entries in
postgresql.conf are still processed only at postmaster startup.

The problem has existed since old version, but a user is more likely
to encounter it since 9.4 where ALTER SYSTEM command was introduced.
So back-patch to 9.4.

Amit Kapila, slightly modified by me. Per report from Christoph Berg.
src/backend/utils/misc/guc-file.l