Re: includeifexists in configuration file

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Greg Smith <greg(at)2ndQuadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: includeifexists in configuration file
Date: 2011-12-16 01:16:22
Message-ID: 4EEA9BE6.1070808@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/15/2011 06:54 AM, Greg Smith wrote:
> 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

Committed. I changed the elog() call to use ereport(): you're not
supposed to use elog() for things we expect might well happen and cause
log entries - see bottom of
<http://www.postgresql.org/docs/current/static/error-message-reporting.html>.
I've probably been guilty of this in the past, it's a bit too easy to
forget.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-12-16 03:27:37 Re: Moving more work outside WALInsertLock
Previous Message Josh Kupershmidt 2011-12-16 00:36:10 Re: Patch to allow users to kill their own queries