In this article, we find the solution for the “PostgreSQL Error must be member of role”.
This error occurred when using CREATE DATABASE in Amazon RDS. 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.
1. Create role.
CREATE ROLE james;
2. Received error when creating database in Amazon RDS.
CREATE DATABASE tom OWNER= james; ERROR: must be member of role james;
3. Solution for above error is: we have to grant existing role who is having create database privilges(postgres or any other user). In my case david is having CREATE DATABASE prileges.
GRANT james to david;
CREATE DATABASE tom OWNER=james;