includeifexists in configuration file - Mailing list pgsql-hackers

From Greg Smith
Subject includeifexists in configuration file
Date
Msg-id 4EC349E4.1010504@2ndQuadrant.com
Whole thread Raw
Responses Re: includeifexists in configuration file
Re: includeifexists in configuration file
List pgsql-hackers
By recent popular request in the ongoing discussion saga around merging
the recovery.conf, I've added an "includeifexists" directive to the
postgresql.conf in the attached patch.  Demo:

$ tail -n 1 $PGDATA/postgresql.conf
include 'missing.conf'
$ pg_ctl start -l $PGLOG
server starting
$ tail -n 2 $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
$ vi $PGDATA/postgresql.conf
$ tail -n 1 $PGDATA/postgresql.conf
includeifexists 'missing.conf'
$ pg_ctl start -l $PGLOG
server starting
$ tail -n 3 $PGLOG
LOG:  database system was shut down at 2011-11-16 00:17:36 EST
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

There might be a cleaner way to write this that eliminates some of the
cut and paste duplication between this and the regular include
directive.  I'm short on clever but full of brute force tonight.

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


Attachment

pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Configuration include directory
Next
From: Dan Ports
Date:
Subject: Re: FlexLocks