Re: Could not create a tablespace - permission denied - Mailing list pgsql-admin

From Joshua D. Drake
Subject Re: Could not create a tablespace - permission denied
Date
Msg-id 480A1A55.6090800@commandprompt.com
Whole thread Raw
In response to Re: Could not create a tablespace - permission denied  (Graham Leggett <minfrin@sharp.fm>)
Responses Re: Could not create a tablespace - permission denied
List pgsql-admin
Graham Leggett wrote:

> After the postgres user was granted permission to access the tablespace
> directory, and after it was verified that the postgres user was able to
> access the tablespace directory, postgresql refused to allow the
> tablespace to be created until the postgresql server was restarted.

I am pretty sure you are missing something. I can not reproduce your issue:

jd@scratch:~$ mkdir /tmp/foo
jd@scratch:~$ psql -U postgres
postgres=# \h create tablespace
Command:     CREATE TABLESPACE
Description: define a new tablespace
Syntax:
CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory'

postgres=# create tablespace foobar location '/tmp/foo';
ERROR:  could not set permissions on directory "/tmp/foo": Operation not
permitted
postgres=#
[1]+  Stopped                 psql -U postgres
jd@scratch:~$ sudo su -
[sudo] password for jd:
root@scratch:~# chown postgres:postgres /tmp/foo
root@scratch:~# exit
logout
jd@scratch:~$ fg
psql -U postgres

postgres=# create tablespace foobar location '/tmp/foo';
CREATE TABLESPACE
postgres=#

But I am glad your problem is resolved.

Joshua D. Drake

pgsql-admin by date:

Previous
From: Graham Leggett
Date:
Subject: Re: Could not create a tablespace - permission denied
Next
From: Tom Lane
Date:
Subject: Re: Could not create a tablespace - permission denied