Re: includeifexists in configuration file

Greg Smith <greg@2ndquadrant.com>

From: Greg Smith <greg@2ndQuadrant.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-12-15T11:54:57Z
Lists: pgsql-hackers

Attachments

On 12/12/2011 04:47 PM, Andrew Dunstan wrote:
> I have briefly looked at the code (but not tried to apply or build 
> it), and modulo the naming issue it looks OK to me.
> Unless there is some other issue let's just get it applied. It looks 
> like almost a no-brainer to me.

It isn't very fancy, but is does something people that can fit into a 
couple of use-cases.  Attached update has two changes to address the 
suggestions I got, which closes everything I knew about with this one:

-It's now include_if_exists
-Files that are skipped are logged now

So current behavior:

$ tail -n 1 postgresql.conf
include 'missing.conf'
$ start
server starting
$ tail $PGLOG
LOG:  could not open configuration file 
"/home/gsmith/pgwork/data/include-exists/missing.conf": No such file or 
directory
FATAL:  configuration file 
"/home/gsmith/pgwork/data/include-exists/postgresql.conf" contains errors

And new behavior:

$ vi $PGDATA/postgresql.conf
$ tail -n 1 postgresql.conf
include_if_exists 'missing.conf'
$ start
server starting
$ tail $PGLOG
LOG:  skipping missing configuration file 
"/home/gsmith/pgwork/data/include-exists/missing.conf"
LOG:  database system was shut down at 2011-12-15 06:48:46 EST
LOG:  database system is ready to accept connections

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us