Thread: postgresql.conf evaluation of duplicate keys

postgresql.conf evaluation of duplicate keys

From
Martin Gerdes
Date:
I've got a question relating to how the postgres configuration is parsed:

If I write into the following into postgresql.conf:
shared_buffers = 24MB
shared_buffers = 32MB

and start up postgres, the command 'show shared_buffers;' answers
'32MB'. That means the later value in the configuration file took
precedence. Which is great and what I would expect.
Now the question: Is this just a happy accident and could change at any
time, or is this documented and guaranteed behaviour (and if so, can you
point me to the relevant documentation)? I tried to search for it, but
my google foo is just not strong enough :-)

Answer to the (probably) inevitable question: "What are you trying to
achieve?" :
I am trying to define a set of defaults, which will get deployed to
multiple servers, and will be overwritten automatically. Yet I also want
to have the option to change individual parameters on one server. So I
want to introduce a line "#==do not modify above this line==".
Everything above the line will be replaced, everything below it left
untouched.
So if postgres is actually also parsing a file "postgresql.local" whose
values are guaranteed to take precedence over "postgresql.conf", that
would solve my problem as well.

Many thanks in advance!

Martin


Re: postgresql.conf evaluation of duplicate keys

From
David Kerr
Date:
On 03/21/2012 07:02 AM, Martin Gerdes wrote:
> I've got a question relating to how the postgres configuration is parsed:
>
> If I write into the following into postgresql.conf:
> shared_buffers = 24MB
> shared_buffers = 32MB
>
> and start up postgres, the command 'show shared_buffers;' answers
> '32MB'. That means the later value in the configuration file took
> precedence. Which is great and what I would expect.
> Now the question: Is this just a happy accident and could change at
> any time, or is this documented and guaranteed behaviour (and if so,
> can you point me to the relevant documentation)? I tried to search for
> it, but my google foo is just not strong enough :-)
>
> Answer to the (probably) inevitable question: "What are you trying to
> achieve?" :
> I am trying to define a set of defaults, which will get deployed to
> multiple servers, and will be overwritten automatically. Yet I also
> want to have the option to change individual parameters on one server.
> So I want to introduce a line "#==do not modify above this line==".
> Everything above the line will be replaced, everything below it left
> untouched.
> So if postgres is actually also parsing a file "postgresql.local"
> whose values are guaranteed to take precedence over "postgresql.conf",
> that would solve my problem as well.
>
> Many thanks in advance!
>
> Martin
>
>
I'm doing basically the same thing except my postgresql.conf "includes"
a "server.conf" and the server.conf would contain any overrides.

I am counting on the behavior you mentioned above to allow this to
happen as well.

Dave