Re: Alternate data locations ? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Alternate data locations ?
Date
Msg-id 7097.966723433@sss.pgh.pa.us
Whole thread Raw
In response to Alternate data locations ?  (Patrick Spinler <spinler@means.net>)
List pgsql-bugs
Patrick Spinler <spinler@means.net> writes:
> $ export ARC_P_DAT_01="/home/httpd/data/arc_p_dat_01"
> $ initlocation initlocation $ARC_P_DAT_01
> <snip>
> initlocation is complete
> $ createdb -D $ARC_P_DAT_01 test
> ERROR:  The database path '/home/httpd/data/arc_p_dat_01' is invalid.
> This may be due to a character that is not allowed or because the chosen
> path isn't permitted for databases
> createdb: database creation failed
> $ sudo -u postgres ls -l $ARC_P_DAT_01
> total 4
> drwx------    2 postgres http_adm     4096 Aug 18 23:10 base

> So, everything looks okay.  Can anyone give me a hint what might be
> happening ?  What can I do to debug this ?

You can't do it that way unless you've compiled the backend with
ALLOW_ABSOLUTE_DBPATHS defined, which is not the default setup
(mainly because some people consider it a security hole).

The standard way is (having done the initlocation script):
  1. (Re) start the postmaster with ARC_P_DAT_01 defined in its
     environment --- notice that you did not define that path variable
     in the postmaster's environment, only the client's.
  2. Do the createdb with -D ARC_P_DAT_01 (no dollar sign).

The idea is that the set of allowed database locations is controlled
by the dbadmin via putting them into the postmaster's environment or
not.  I find this quite bogus myself, because the postmaster
environment will probably contain lots of things like $HOME that should
*not* be treated as database locations.  But presently that's the setup.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fw: PortalHeapMemoryFree error in OpenACS
Next
From: Chris
Date:
Subject: Large Object / libPQ : problem