Re: Patch for 9.1: initdb -C option

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: David Christensen <david(at)endpoint(dot)com>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch for 9.1: initdb -C option
Date: 2010-03-29 05:49:24
Message-ID: 4BB03F64.4070605@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Christensen wrote:
> Enclosed is a patch to add a -C option to initdb to allow you to easily append configuration directives to the generated postgresql.conf file for use in programmatic generation.

We had a patch not quite make it for 9.0 that switched over the
postgresql.conf file to make it easy to scan a whole directory looking
for configuration files:
http://archives.postgresql.org/message-id/9837222c0910240641p7d75e2a4u2cfa6c1b5e603d84@mail.gmail.com

The idea there was to eventually reduce the amount of postgresql.conf
hacking that initdb and other tools have to do. Your patch would add
more code into a path that I'd like to see reduced significantly.

That implementation would make something easy enough for your use case
too (below untested but show the general idea):

$ for cluster in 1 2 3 4 5 6;
do initdb -D data$cluster
(
cat <<EOF
port = 1234$cluster;
max_connections = 10;
shared_buffers=1M;
EOF
) > data$cluster/conf.d/99clustersetup
done

This would actually work just fine for what you're doing right now if
you used ">> data$cluster/postgresql.conf" for that next to last line
there. There would be duplicates, which I'm guessing is what you wanted
to avoid with this patch, but the later values set for the parameters
added to the end would win and be the active ones.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-03-29 06:47:11 Re: Proposal: Add JSON support
Previous Message Takahiro Itagaki 2010-03-29 05:37:59 Re: Patch for 9.1: initdb -C option