Обсуждение: Alternate data locations ?

Поиск
Список
Период
Сортировка

Alternate data locations ?

От
Patrick Spinler
Дата:
Hi:

I'm installing postgresql-7.0.2 from ftp.postgresql.org on a clean
redhat 6.2 system.

I'd like to create an alternate data location, similar to that supported
in pgsql 6.3, so,
I do:

$ 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 ?

Thanks,
-- Pat

Re: Alternate data locations ?

От
Tom Lane
Дата:
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