Thread: Alternate Location

Alternate Location

From
Jason Davis
Date:
I'm having some trouble getting the alternate location option for createdb
to work. I have an environment variable PGDATA2 which contains the value
"/u2/pgdata" which is a directory owned by pgsql and is writeable. The
initlocation script worked ok but when I try to createdb test -D 'PGDATA2'
with or without single quotes I keep getting the "invalid path" error
message, no matter what permissions I give the directories. My base install
is in /usr/local/pgsql and my platform is FreeBSD.

It has in fact created a "base" directory under my /u2/pgdata directory
with permissions 700 and that's as far as it gets. I can write under
/u2/pgdata with the pgsql account. Am I missing something basic?

cheers

Jason Davis
Database Administrator/Programmer
Tas Access
www.tassie.net.au


Re: Alternate Location

From
Tom Lane
Date:
Jason Davis <jdavis@tassie.net.au> writes:
> I'm having some trouble getting the alternate location option for createdb
> to work. I have an environment variable PGDATA2 which contains the value
> "/u2/pgdata" which is a directory owned by pgsql and is writeable.

One thing that's often missed is that the environment variable must
exist in the *postmaster*'s environment; whether it exists in your
client psql environment is irrelevant.  The reason is that the
environment var is being used as a crude form of security --- we
want the DBA to have decided which alternate locations are OK, not
the user.  So the DBA (postgres user) must set up the environment
var before starting the postmaster.

If that ain't it, we'll need more details...

            regards, tom lane