Skip site navigation (1) Skip section navigation (2)

Patch for 9.1: initdb -C option

From: David Christensen <david(at)endpoint(dot)com>
To: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Patch for 9.1: initdb -C option
Date: 2010-03-29 05:04:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

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.  In my case, I'd been creating multiple db clusters with a script and would have specific overrides that I needed to make.   This patch fell out of the desire to make this a little cleaner.  Please review and comment.

From the commit message:

    This is a simple mechanism to allow you to provide explicit overrides
    to any GUC at initdb time.  As a basic example, consider the case
    where you are programmatically generating multiple db clusters in
    order to test various configurations:
      $ for cluster in 1 2 3 4 5 6;
      >   do initdb -D data$cluster -C "port = 1234$cluster" -C 'max_connections = 10' -C shared_buffers=1M;
      > done
    A possible future improvement would be to provide some basic
    formatting corrections to allow specificications such as -C 'port
    1234', -C port=1234, and -C 'port = 1234' to all be ultimately output
    as 'port = 1234' in the final output.  This would be consistent with
    postmaster's parsing.
    The -C flag was chosen to be a mnemonic for "config".


David Christensen
End Point Corporation

Attachment: 0001-Add-C-option-to-initdb-to-allow-invocation-time-GUC-.patch
Description: application/octet-stream (5.9 KB)
Attachment: initdb-dash-C.diff
Description: application/octet-stream (5.3 KB)


pgsql-hackers by date

Next:From: Takahiro ItagakiDate: 2010-03-29 05:37:59
Subject: Re: Patch for 9.1: initdb -C option
Previous:From: Robert HaasDate: 2010-03-29 03:52:42
Subject: Re: Proposal: Add JSON support

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group