This is a patch that allows PostgreSQL to use a configuration
file that is outside the main database directory.

It adds one more command line parameter, "-C" which
specifies the location of the postgres configuration file.

A patched version of PostgreSQL will function as:

postmaster -C /etc/postgres/postgresql.conf

This will direct the postmaster program to use the
configuration file "/etc/postgres/postgresql.conf"

Within this file are four  additional parameters: include,
hba_conf,ident_conf, and data_dir.

They are used as:
include = '/etc/postgres/debug.conf'
data_dir = '/vol01/postgres'
hba_conf = '/etc/postgres/pg_hba_conf'
ident_conf = '/etc/postgres/pg_ident.conf'

The "-D" option on the command line overrides the "data_dir"
in the configuration file.

If no hba_conf and/or ident_conf setting is specified, the default
$PGDATA/pg_hba.conf and/or $PGDATA/pg_ident.conf will be used.

This patch is intended to move the PostgreSQL configuration out of the
data directory so that it can be modified and backed up.

This patch is also useful for running multiple servers with the same
parameters:

postmaster -C /etc/postgres/postgresql.conf -D /VOL01/postgres -p 5432
postmaster -C /etc/postgres/postgresql.conf -D /VOL02/postgres -p 5433

To apply the patch, enter your PostreSQL source directory, and run:

cat pgec-PGVERSON.patch | patch -p 1
Mon, 17 Feb 2003 12:54:33 -0500
mlw <pgsql@mohawksoft.com>
new Configuration patch, implements 'include'
mlw <pgsql@mohawksoft.com> writes:
> If no hba_conf and/or ident_conf setting is specified, the default
> $PGDATA/pg_hba.conf and/or $PGDATA/pg_ident.conf will be used.

Doesn't anybody see the (a) inconsistency and (b) uselessness of this?
If you are trying to keep your config files out of the data directory,
it's hardly sensible to default to finding two out of three there.

We should have a -C that specifies a *directory*, and all three config
files should be sought therein.  The argument that that somehow forces
people to use symlinks doesn't convince me at all.

But I've grown tired of arguing, because it's clear that I'm making no
impact whatever :-(.  I'm done with this thread.

			regards, tom lane

Mon, 17 Feb 2003 13:43:17 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: new Configuration patch, implements 'include' 
Tom Lane wrote:
> mlw <pgsql@mohawksoft.com> writes:
> > If no hba_conf and/or ident_conf setting is specified, the default
> > $PGDATA/pg_hba.conf and/or $PGDATA/pg_ident.conf will be used.
> 
> Doesn't anybody see the (a) inconsistency and (b) uselessness of this?
> If you are trying to keep your config files out of the data directory,
> it's hardly sensible to default to finding two out of three there.
> 
> We should have a -C that specifies a *directory*, and all three config
> files should be sought therein.  The argument that that somehow forces
> people to use symlinks doesn't convince me at all.

I think the issue here is that symlinks are OK to implement unusual
configuration cases, and I think we can say having the three config
files in different directories is unusual.  I think you have to weigh
the downside of using symlinks for rare configurations compared to the
complexity of specifying the config file locations in three separate
cases.

I had thrown out the idea of putting the config files in their own
directory _under_ /data, like /data/etc, so you could just symlink that
directory to somewhere else.  Makes backups of config files easy, and
makes it initdb-safe, because only the symlink can be under /data. 
However, no one commented on it, so I assume they didn't like it.  It
seems like a nice middle ground to me.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Mon, 17 Feb 2003 14:21:11 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: new Configuration patch, implements 'include'
Tom Lane wrote:

>mlw <pgsql@mohawksoft.com> writes:
>  
>
>>If no hba_conf and/or ident_conf setting is specified, the default
>>$PGDATA/pg_hba.conf and/or $PGDATA/pg_ident.conf will be used.
>>    
>>
>
>Doesn't anybody see the (a) inconsistency and (b) uselessness of this?
>If you are trying to keep your config files out of the data directory,
>it's hardly sensible to default to finding two out of three there.
>
>We should have a -C that specifies a *directory*, and all three config
>files should be sought therein.  The argument that that somehow forces
>people to use symlinks doesn't convince me at all.
>
>But I've grown tired of arguing, because it's clear that I'm making no
>impact whatever :-(.  I'm done with this thread.
>
Tom, I don't know why you are arguing at all. One thing I wish to 
impress on you, I think it is a point of view you are missing. It isn't 
about something being "easier" as much as it is about being flexable 
enough to fit into the deployment strategy of the admin or vendor.

Sometimes you make things more difficult when you make it more 
standardized.  When I setup a system with Apache, PHP, PostgreSQL, 
named, et al, I am always just irritated that PostgreSQL's configuration 
parameters can not be stored with all the others. I usually make one 
install tarball or zip that contains all the binaries and configuration. 
I can't do that with PostgreSQL.

I don't like the idea of specifying a directory, per se' because if you 
have multiple database installations, how would you share the 
configuration without symlinks?

I will modify my patch to check if the configuration parameter is a 
directory. If it is, it will make the default filenames within the 
directory and post it when it is gone.


Mon, 17 Feb 2003 14:26:08 -0500
mlw <pgsql@mohawksoft.com>
Re: new Configuration patch, implements 'include'
mlw wrote:
> I don't like the idea of specifying a directory, per se' because if you 
> have multiple database installations, how would you share the 
> configuration without symlinks?

Oh, for example, you would be sharing postgresql.conf, perhaps, but not
pg_hba.conf.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Mon, 17 Feb 2003 14:31:07 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: new Configuration patch, implements 'include'


Bruce Momjian wrote:

>mlw wrote:
>  
>
>>I don't like the idea of specifying a directory, per se' because if you 
>>have multiple database installations, how would you share the 
>>configuration without symlinks?
>>    
>>
>
>Oh, for example, you would be sharing postgresql.conf, perhaps, but not
>pg_hba.conf.
>  
>
Actually, the other way around.

An "official" pg_hba.conf and pg_ident.conf setup by an admin, but 
differing postgresql.conf files for different databases. Does that make 
sense?


>  
>


Mon, 17 Feb 2003 15:14:02 -0500
mlw <pgsql@mohawksoft.com>
Re: new Configuration patch, implements 'include'