在PostgreSQL中创建表空间 [英] Creating a tablespace in postgresql

查看:846
本文介绍了在PostgreSQL中创建表空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在postgres中创建一个表空间,但是遇到所有权问题。我正在使用的命令是:

I'm trying to create a tablespace in postgres, but I'm getting ownership problems. The command I'm using is:

CREATE TABLESPACE magdat OWNER maggie LOCATION '/home/john/BSTablespace'

我收到错误:

ERROR:  could not set permissions on directory "/home/john/BSTablespace": Operation not permitted

该文件夹属于postgres:postgres,我尝试将其更改为maggie,但如果我这样做:

The folder belongs to postgres:postgres, I've tried changing it to maggie, but if I go :

chown maggie:postgres /home/john/BSTablespace

我得到:

chown: invalid user: `maggie:postgres'

用户为何不存在?如果我列出了postgres中的用户,它的确会出现。有什么想法我可能做错了吗?

How come the user does not exist? If I list the users inside of postgres it does come up. Any ideas what I could be doing wrong?

推荐答案

我很容易猜到问题出在父目录的权限上 / home / john。您的主目录可能已设置好,因此只有您的用户才能访问它(即chmod 700)(将主目录设置为chmod 700是一件好事,不要更改它)。

I would hazard a guess that the problem lies in the permissions of the parent directory "/home/john". Your home directory is probably setup so that only your user has access (i.e chmod 700) to it (it's a good thing for your home directory to be chmod 700, don't change it).

做类似的事情:


mkdir /BSTablespace
chown postgres:postgres /BSTablespace

然后


CREATE TABLESPACE magdat OWNER maggie LOCATION '/BSTablespace';

应该可以正常工作。

关于用户Maggie:数据库用户不是与OS用户相同。这并不是说您不能在两个地方都拥有名为maggie的用户,但是您需要在数据库和OS中都创建该用户才能实现。

Regarding the user maggie: database users are not the same as OS users. That isn't to say that you couldn't have a user in both places named maggie-- but you would need to create the user in both the database and the OS for that to happen.

这篇关于在PostgreSQL中创建表空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆