Re: Alternate database locations - Mailing list pgsql-general

From Glen Parker
Subject Re: Alternate database locations
Date
Msg-id 013401c1b983$f875d250$0b01a8c0@johnpark.net
Whole thread Raw
In response to Alternate database locations  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Alternate database locations
List pgsql-general
>   I want to set up a database in a directory other than
> /var/lib/pgsql/data/, so in both postgres' ~/.bash_profile and my
> ~/.bash_profile I added the line:
>
> PGDATA2="/opt/paisley/"; export PGDATA2
>
<snip>

> ERROR:  Postmaster environment variable 'PGDATA2' not set
> createdb: database creation failed

your init script is using the '-s /bin/sh' argument to 'su', which means
bash runs in compat mode (sh is a soft link to bash on linux), and does not
use .bash_profile.  you need to set up a file ~postgres/.profile (along side
of .bash_profile) and put your PGDATA2 environment export in there, or
possibly source .profile from .bash_profile.  restart the postmaster and it
should now work.

guys, is there a good reason why the init script has to specify a shell
explicitly?  the passwd entry for postgres should be good enough it seems
like... changing the init script at install time is a bad solution because
it gets over-written on postgres upgrades from RPM.  and adding a .profile
file is not exactly intuative, and the need for it is not documented
anywhere that i could find.

Glen


pgsql-general by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: Report generation
Next
From: Tom Lane
Date:
Subject: Re: Alternate data location, again