“错误:必须是角色的成员"在 PostgreSQL 中创建模式时 [英] "ERROR: must be member of role" When creating schema in PostgreSQL

查看:520
本文介绍了“错误:必须是角色的成员"在 PostgreSQL 中创建模式时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用超级用户帐户登录,这是我正在做的过程:

I'm logged in with a superuser account and this is the process I'm doing:

1-> CREATE ROLE test WITH IN ROLE testroles PASSWORD 'testpasswd'
2-> CREATE SCHEMA AUTHORIZATION test

角色已正确创建,但在尝试创建架构时出现此错误:

The role is correctly created but I'm getting this error when trying to create the Schema:

ERROR:  must be member of role "test"

推荐答案

我在 Amazon RDS 上使用 CREATE DATABASE 时遇到了这个问题.我认为它本质上与使用 CREATE SCHEMA 相同.

I ran into this issue when using CREATE DATABASE on Amazon RDS. I think it's essentially the same as using CREATE SCHEMA.

使用 Amazon RDS 时,发出 CREATE DATABASE 的用户必须是将成为数据库所有者的角色的成员.就我而言,我使用的超级用户帐户称为 root,我将创建一个角色 o,它将拥有一个数据库 d:

When using Amazon RDS, the user issuing the CREATE DATABASE must be a member of the role that will be the owner of the database. In my case, the superuser account I'm using is called root, and I'm going to create a role o which is going to own a database d:

postgres=> CREATE ROLE o;
CREATE ROLE

postgres=> CREATE DATABASE d OWNER = o;
ERROR:  must be member of role "o"

postgres=> GRANT o TO root;
GRANT ROLE

postgres=> CREATE DATABASE d OWNER = o;
CREATE DATABASE

这篇关于“错误:必须是角色的成员"在 PostgreSQL 中创建模式时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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