Re: initlocation and createdb - Mailing list pgsql-general

From Ed Loehr
Subject Re: initlocation and createdb
Date
Msg-id 3946A473.AFAD0D07@austin.rr.com
Whole thread Raw
In response to initlocation and createdb  ("Barnes" <aardvark@ibm.net>)
List pgsql-general
Barnes wrote:
>
> I'm having trouble setting up databases in a new location.  In particular, I
> do the following:
>
> [postgres@whopper pgdata]$ export PGDATA2=/home/pgdata
> [postgres@whopper pgdata]$ initlocation PGDATA2
> The location will be initialized with username "postgres".
> This user will own all the files and must also own the server process.
>
> Fixing permissions on pre-existing directory /home/pgdata
> Creating directory /home/pgdata/base
>
> initlocation is complete.
> You can now create a database using
>   CREATE DATABASE <name> WITH LOCATION = 'PGDATA2'
> in SQL, or
>   createdb <name> -D 'PGDATA2'
> from the shell.
>
> [postgres@whopper pgdata]$ createdb optodb -D 'PGDATA2'
> ERROR:  The database path 'PGDATA2' 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
> [postgres@whopper pgdata]$
>
> The permissions for /home/pgdata are
>
> drwx------   3 postgres postgres     4096 Jun 13 16:41 pgdata
>
> What am I doing wrong?  Is /home not permitted for databases?  If so, why
> not, and what is permitted?

I don't know what's wrong, but it seems strange that you would pass
'PGDATA2' and not $PGDATA2 to initlocation (i.e., strange to let an
application interpret a passed-in shell variable rather than shell
interpretation).  Not sure it's *wrong*, though, 'cuz it seems to
interpret it as '/home/pgdata', suggesting maybe it does interpret the
shell variable.  But the latter "CREATE DATABASE" command suggests it is
bogus...

Regards,
Ed Loehr

pgsql-general by date:

Previous
From: "Barnes"
Date:
Subject: initlocation and createdb
Next
From: Ed Loehr
Date:
Subject: Re: initlocation and createdb